:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --border-radius: 0.5rem;
    --transition: all 0.3s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    background: linear-gradient(90DEG, #667eea 0%, #764ba2 100%) !important;
    min-height: 100vh;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    padding: 3rem 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

header h1 {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

header p {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.textInfo {
    background: var(--light-bg);
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    color: var(--primary-color);
}

/* Main Container */
#main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.container-qr {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
}

/* Card Principal */
.card-qr {
    background: rgba(255, 255, 255, 0.98);
    border: none;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.card-qr .card-body {
    padding: 2.5rem;
}

/* Input Group */
.input-group-qr {
    margin-bottom: 1.5rem;
}

.input-group-qr label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.form-control-qr {
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control-qr:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    outline: none;
}

/* Button Group */
.btn-group-qr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

@media (min-width: 576px) {
    .btn-group-qr {
        grid-template-columns: 2fr 1fr;
    }
}

@media (min-width: 768px) {
    .btn-group-qr {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

.btn-primary-qr, .btn-secondary-qr {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-primary-qr {
    background: var(--primary-color);
    color: white;
}

.btn-primary-qr:hover {
    background: #0b5ed7;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(13, 110, 253, 0.4);
}

.btn-secondary-qr {
    background: var(--light-bg);
    color: #333;
    border: 1px solid #e0e0e0;
}

.btn-secondary-qr:hover {
    background: #e9ecef;
    border-color: var(--primary-color);
}

/* QR Code Display */
.qr-display {
    text-align: center;
    padding: 2rem;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.qr-display.empty {
    color: var(--secondary-color);
}

.qr-display.empty p {
    font-size: 1.1rem;
    margin-bottom: 0;
}

#qrCode {
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#qrCode img,
#qrCode canvas {
    display: block;
}

/* Action Buttons */
.qr-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.btn-action {
    padding: 0.65rem 1.25rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-save {
    background: var(--success-color);
    color: white;
}

.btn-save:hover {
    background: #157347;
    transform: translateY(-2px);
}

.btn-share {
    background: #0084b4;
    color: white;
}

.btn-share:hover {
    background: #006fa3;
    transform: translateY(-2px);
}

.btn-whatsapp {
    background: #25d366;
    color: white;
}

.btn-whatsapp:hover {
    background: #1ead56;
    transform: translateY(-2px);
}

.btn-copy {
    background: var(--secondary-color);
    color: white;
}

.btn-copy:hover {
    background: #5c636a;
    transform: translateY(-2px);
}

.btn-paste {
    background: #6c757d;
    color: white;
}

.btn-paste:hover {
    background: #5c636a;
    transform: translateY(-2px);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Size Input Group */
.size-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.size-control input {
    flex: 1;
}

.size-value {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 60px;
    text-align: center;
}

/* Alert Messages */
.alert-custom {
    border: none;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    animation: slideDown 0.3s ease-in-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: #d1e7dd;
    color: #0f5132;
    border-left: 4px solid #198754;
}

.alert-danger {
    background: #f8d7da;
    color: #842029;
    border-left: 4px solid #dc3545;
}

/* Footer */
footer {
    background: rgba(0, 0, 0, 0.2);
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
    font-size: 0.95rem;
}

footer a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

footer a:hover {
    text-decoration: underline;
    color: #ffd700;
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        padding: 2rem 1rem;
        margin-bottom: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 0.95rem;
    }

    .card-qr .card-body {
        padding: 1.5rem;
    }

    .qr-display {
        min-height: 250px;
    }

    .qr-actions {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

@media (max-width: 480px) {
    .container-qr {
        padding:0 !important;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .card-qr .card-body {
        padding: 1rem;
    }

    .btn-primary-qr, .btn-secondary-qr {
        font-size: 0.85rem;
        padding: 0.65rem 0.5rem;
    }

    .size-control {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .qr-actions {
        grid-template-columns: 1fr 1fr;
    }
    
    .btn-save, .btn-whatsapp, .btn-share, .btn-copy {
        font-size: 0.85rem;
        padding: 0.65rem 0.5rem;
    }
}

/* Loading Animation */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: slideInUp 0.3s ease-in-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast-notification.success {
    border-left: 4px solid var(--success-color);
    color: var(--success-color);
}

.toast-notification.error {
    border-left: 4px solid var(--danger-color);
    color: var(--danger-color);
}