:root {
    --primary-color: #4a90e2;
    --secondary-color: #6c5ce7;
    --background: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.1);
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.2);
    --glass-blur: blur(12px);
    --success-color: #10b981;
    --danger-color: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--background);
    background-image: radial-gradient(circle at 10% 20%, rgba(74, 144, 226, 0.2) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(108, 92, 231, 0.2) 0%, transparent 40%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    width: 100%;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 3rem;
    letter-spacing: 1px;
}

.logo i {
    font-size: 1.8rem;
}

nav ul {
    list-style: none;
}

nav li {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

nav li:hover {
    background: var(--card-bg);
    color: var(--text-color);
}

nav li.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.sidebar-footer {
    margin-top: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

/* Main Content area */
.main-content {
    flex: 1;
    padding: 2rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    margin-bottom: 2.5rem;
}

.section-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-muted);
}

/* Glass Card */
.glass {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Form Styling */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: span 2;
}

label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

input, select, textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.1);
}

.amount-input {
    position: relative;
    display: flex;
    align-items: center;
}

.currency {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-weight: 600;
}

.amount-input input {
    padding-left: 35px;
    width: 100%;
}

select option {
    background-color: var(--background);
    color: white;
}

/* Buttons */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s, box-shadow 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: #3a7bc8;
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.btn-secondary {
    background: var(--card-bg);
    color: white;
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Invoice Preview Section */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

.preview-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

/* Invoice Template Styling (The printable part) */
.invoice-container {
    background-color: #fff;
    color: #1a1a1a;
    padding: 50px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 800px;
    margin: 0 auto;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.invoice-branding {
    display: flex;
    align-items: center;
    gap: 15px;
}

.invoice-logo {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
}

.invoice-title h2 {
    font-size: 1.8rem;
    letter-spacing: 1px;
    color: #333;
}

.invoice-title p {
    font-size: 0.85rem;
    color: #777;
}

.invoice-meta h1 {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 5px;
    text-align: right;
}

.invoice-meta p {
    font-size: 0.9rem;
    color: #555;
    text-align: right;
}

.invoice-divider {
    border: 0;
    height: 2px;
    background: #f0f0f0;
    margin: 30px 0;
}

.invoice-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.info-block h4 {
    color: #999;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.info-block p {
    font-size: 1rem;
    line-height: 1.5;
}

.highlight {
    font-weight: 700;
    font-size: 1.2rem !important;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 40px;
}

.invoice-table th {
    background: #f8fafc;
    text-align: left;
    padding: 15px;
    color: #64748b;
    font-size: 0.85rem;
    border-bottom: 2px solid #e2e8f0;
}

.invoice-table td {
    padding: 20px 15px;
    border-bottom: 1px solid #f1f5f9;
}

.invoice-table td small {
    color: #94a3b8;
}

.concept-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.badge-once {
    background: #eff6ff;
    color: #3b82f6;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #dbeafe;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.row-activation {
    background-color: #f8fafc;
}

.text-right {
    text-align: right;
}

.invoice-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
}

.detail-item span {
    color: #777;
    font-size: 0.9rem;
}

.payment-due {
    color: var(--danger-color);
}

.total-section {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.grand-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #e2e8f0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
}

.invoice-footer {
    text-align: center;
    border-top: 2px solid #f0f0f0;
    padding-top: 30px;
    margin-top: 20px;
}

.invoice-footer p {
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 30px;
}

.signature-line {
    width: 200px;
    margin: 0 auto;
    border-top: 1px solid #ccc;
    padding-top: 10px;
}

/* Sello de PAGADO */
.invoice-container {
    position: relative; /* Para el posicionamiento del sello */
}

.paid-stamp {
    position: absolute;
    top: 180px;
    right: 50px;
    border: 5px solid #10b981;
    color: #10b981;
    font-size: 3rem;
    font-weight: 800;
    padding: 10px 30px;
    border-radius: 8px;
    transform: rotate(-15deg);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 5px;
    pointer-events: none;
    user-select: none;
}

.paid-stamp::after {
    content: "BEATRIZ SYSTEM VERIFIED";
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    background: white;
    padding: 0 5px;
}

/* Toast System */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--success-color);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.hidden {
    transform: translateY(150px);
}

/* Print Rules */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .no-print {
        display: none !important;
    }
    
    .app-container {
        display: block !important;
    }
    
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }

    .view-section {
        display: block !important;
    }

    #invoice-preview {
        display: block !important;
    }

    .invoice-container {
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        position: relative; /* Asegurar posicionamiento del sello en print */
    }

    .paid-stamp {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border-color: #10b981 !important;
        color: #10b981 !important;
    }

    #form-section {
        display: none !important;
    }

    /* Reset background colors for correct printing */
    .invoice-logo {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .total-section {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background: #f8fafc !important;
    }
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        width: 80px;
        padding: 2rem 0.5rem;
    }
    .sidebar span, .sidebar-footer {
        display: none;
    }
    .main-content {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-group.full-width {
        grid-column: span 1;
    }
}
