/* Invoice Pro - Complete Styling System */
/* ===================================== */

/* CSS Variables */
:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --success-light: #d1fae5;
    --warning-color: #f59e0b;
    --warning-light: #fef3c7;
    --danger-color: #ef4444;
    --danger-light: #fee2e2;
    --info-color: #3b82f6;
    --info-light: #dbeafe;
    
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --transition: all 0.3s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* ===================== */
/* Login Page Styles */
/* ===================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-box {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .logo-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.login-header h1 {
    color: var(--text-primary);
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-secondary);
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.input-icon {
    position: relative;
}

.input-icon .input-icon-left {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.input-icon input {
    padding-left: 45px;
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 10px;
    font-size: 14px;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: var(--primary-color);
}

.login-footer {
    margin-top: 30px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.login-footer small {
    color: var(--text-muted);
}

/* ===================== */
/* Form Elements */
/* ===================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--card-bg);
    color: var(--text-primary);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--bg-color);
    cursor: not-allowed;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Checkbox & Radio */
.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 0;
}

.checkbox-label input,
.radio-label input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-right: 10px;
    transition: var(--transition);
}

.toggle-label:has(input:checked) {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.toggle-label input {
    width: auto;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

/* ===================== */
/* Buttons */
/* ===================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

/* ===================== */
/* Navigation */
/* ===================== */

.navbar {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    padding: 15px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.nav-brand i {
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.nav-item:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.nav-item.active {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.nav-item.logout-btn {
    color: var(--danger-color);
}

.nav-item.logout-btn:hover {
    background: var(--danger-light);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

@media (max-width: 900px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--card-bg);
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow-lg);
        display: none;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-item {
        width: 100%;
        justify-content: flex-start;
    }
    
    .nav-actions {
        flex-wrap: wrap;
    }
}

/* ===================== */
/* Main Content */
/* ===================== */

.main-content {
    padding: 25px;
    max-width: 1400px;
    margin: 0 auto;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i {
    color: var(--primary-color);
}

/* ===================== */
/* Stats Cards */
/* ===================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 1.75rem;
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.stat-blue .stat-icon { background: var(--info-light); color: var(--info-color); }
.stat-green .stat-icon { background: var(--success-light); color: var(--success-color); }
.stat-yellow .stat-icon { background: var(--warning-light); color: var(--warning-color); }
.stat-red .stat-icon { background: var(--danger-light); color: var(--danger-color); }
.stat-purple .stat-icon { background: #ede9fe; color: #8b5cf6; }
.stat-teal .stat-icon { background: #ccfbf1; color: #14b8a6; }
.stat-green-light .stat-icon { background: var(--success-light); color: var(--success-color); }
.stat-yellow-light .stat-icon { background: var(--warning-light); color: var(--warning-color); }

/* ===================== */
/* Charts */
/* ===================== */

.chart-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.chart-box {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow);
}

.chart-box h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.chart-box canvas {
    max-height: 300px;
}

/* ===================== */
/* Tables */
/* ===================== */

.table-responsive {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-color);
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: var(--bg-color);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.status-active, .status-paid {
    background: var(--success-light);
    color: var(--success-color);
}

.status-suspended, .status-unpaid {
    background: var(--warning-light);
    color: var(--warning-color);
}

.status-terminated, .status-overdue {
    background: var(--danger-light);
    color: var(--danger-color);
}

.status-draft {
    background: #f1f5f9;
    color: var(--text-secondary);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn.view { background: var(--info-light); color: var(--info-color); }
.action-btn.edit { background: var(--warning-light); color: var(--warning-color); }
.action-btn.delete { background: var(--danger-light); color: var(--danger-color); }
.action-btn.success { background: var(--success-light); color: var(--success-color); }

.action-btn:hover {
    transform: scale(1.1);
}

/* ===================== */
/* Search & Filters */
/* ===================== */

.search-filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    padding-left: 45px;
}

.search-filter-bar select,
.search-filter-bar input[type="date"] {
    min-width: 150px;
}

/* ===================== */
/* Packages Grid */
/* ===================== */

.packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.package-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
}

.package-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.package-card.featured {
    border: 2px solid var(--primary-color);
}

.package-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 25px;
    text-align: center;
}

.package-card.featured .package-header {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.package-header h3 {
    color: white;
    margin-bottom: 5px;
}

.package-price {
    font-size: 2rem;
    font-weight: 700;
}

.package-price span {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.8;
}

.package-body {
    padding: 25px;
}

.package-features {
    list-style: none;
    margin-bottom: 20px;
}

.package-features li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.package-features li:last-child {
    border-bottom: none;
}

.package-features li i {
    color: var(--success-color);
}

.package-actions {
    display: flex;
    gap: 10px;
}

.package-actions .btn {
    flex: 1;
}

/* ===================== */
/* Settings Tabs */
/* ===================== */

.settings-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.settings-form {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
}

/* Logo Upload */
.logo-upload {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.logo-upload img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 10px;
}

.logo-upload input[type="file"] {
    display: none;
}

/* Variable Tags */
.variable-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--bg-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

/* ===================== */
/* Invoice Editor */
/* ===================== */

.invoice-editor {
    padding: 25px;
    max-width: 900px;
    margin: 0 auto;
}

.invoice-form-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
}

.invoice-form-container h2 {
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.invoice-form-container h2 i {
    color: var(--primary-color);
}

.invoice-header-section,
.customer-section,
.items-section,
.notes-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.customer-section h3,
.items-section h3 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.customer-type-toggle {
    margin-bottom: 20px;
}

.customer-preview {
    background: var(--bg-color);
    padding: 15px;
    border-radius: var(--radius);
    margin-top: 15px;
}

.customer-preview p {
    margin-bottom: 5px;
}

/* Items Table */
.items-table-wrapper {
    overflow-x: auto;
    margin-bottom: 15px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
}

.items-table th,
.items-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.items-table th {
    background: var(--bg-color);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
}

.items-table input,
.items-table select {
    padding: 8px;
    font-size: 13px;
}

.items-table .item-name {
    min-width: 150px;
}

.items-table .item-desc {
    min-width: 150px;
}

.items-table .item-qty,
.items-table .item-price,
.items-table .item-total {
    width: 100px;
}

.items-table .item-actions {
    width: 50px;
    text-align: center;
}

.add-item-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Invoice Summary */
.invoice-summary {
    margin-top: 20px;
    margin-left: auto;
    max-width: 400px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row.total-row {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    border-top: 2px solid var(--primary-color);
    margin-top: 10px;
    padding-top: 15px;
}

.adjustment-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.adjustment-input select {
    width: 80px;
    padding: 6px;
}

.adjustment-input input {
    width: 80px;
    padding: 6px;
    text-align: right;
}

/* ===================== */
/* Invoice Preview */
/* ===================== */

.invoice-preview-container {
    padding: 25px;
    max-width: 900px;
    margin: 0 auto;
}

.invoice-preview {
    background: white;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    padding: 50px;
}

.invoice-template {
    font-size: 14px;
}

.invoice-template-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--primary-color);
}

.invoice-logo img {
    max-height: 80px;
    max-width: 200px;
}

.invoice-company-info {
    text-align: left;
}

.invoice-company-info h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.invoice-company-info p {
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.invoice-title-section {
    text-align: right;
}

.invoice-title-section h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.invoice-title-section p {
    margin-bottom: 5px;
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.invoice-parties h4 {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.invoice-parties p {
    margin-bottom: 3px;
}

.invoice-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.invoice-items-table th {
    background: var(--primary-color);
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
}

.invoice-items-table th:last-child {
    text-align: right;
}

.invoice-items-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.invoice-items-table td:last-child {
    text-align: right;
}

.invoice-items-table tbody tr:nth-child(even) {
    background: var(--bg-color);
}

.invoice-totals {
    width: 300px;
    margin-left: auto;
}

.invoice-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.invoice-totals-row.grand-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    border-top: 2px solid var(--primary-color);
    border-bottom: none;
    padding-top: 15px;
}

.invoice-footer {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.invoice-footer h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.invoice-footer p {
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.invoice-payment-link {
    margin-top: 20px;
    text-align: center;
}

.invoice-payment-link a {
    display: inline-block;
    padding: 12px 30px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
}

/* ===================== */
/* Public Invoice View */
/* ===================== */

.public-invoice-container {
    min-height: 100vh;
    padding: 25px;
    background: var(--bg-color);
}

.public-invoice-actions {
    max-width: 900px;
    margin: 20px auto;
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* ===================== */
/* Modals */
/* ===================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--primary-color);
}

.close-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-color);
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.close-btn:hover {
    background: var(--danger-light);
    color: var(--danger-color);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
}

/* Items List Modal */
.items-list {
    max-height: 400px;
    overflow-y: auto;
}

.item-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.item-list-item:hover {
    background: var(--bg-color);
}

.item-list-info h4 {
    margin-bottom: 5px;
}

.item-list-info p {
    color: var(--text-secondary);
    font-size: 13px;
}

.item-list-price {
    font-weight: 600;
    color: var(--primary-color);
}

/* ===================== */
/* Toast Notifications */
/* ===================== */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--card-bg);
    padding: 15px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast.info {
    border-left: 4px solid var(--info-color);
}

.toast i {
    font-size: 1.25rem;
}

.toast.success i { color: var(--success-color); }
.toast.error i { color: var(--danger-color); }
.toast.warning i { color: var(--warning-color); }
.toast.info i { color: var(--info-color); }

/* ===================== */
/* Loading Overlay */
/* ===================== */

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===================== */
/* Recent Section */
/* ===================== */

.recent-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow);
}

.recent-section h3 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recent-section h3 i {
    color: var(--primary-color);
}

/* ===================== */
/* Print Styles */
/* ===================== */

@media print {
    .no-print {
        display: none !important;
    }
    
    .invoice-preview-container {
        padding: 0;
    }
    
    .invoice-preview {
        box-shadow: none;
        padding: 0;
    }
    
    body {
        background: white;
    }
}

/* ===================== */
/* Responsive Adjustments */
/* ===================== */

@media (max-width: 768px) {
    .main-content {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .stat-info h3 {
        font-size: 1.5rem;
    }
    
    .chart-container {
        grid-template-columns: 1fr;
    }
    
    .invoice-template-header {
        flex-direction: column;
        gap: 20px;
    }
    
    .invoice-title-section {
        text-align: left;
    }
    
    .invoice-parties {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .invoice-totals {
        width: 100%;
    }
    
    .invoice-preview {
        padding: 25px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .nav-actions {
        gap: 5px;
    }
    
    .nav-actions .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .nav-actions .btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .login-box {
        padding: 25px;
    }
    
    .modal-content {
        margin: 10px;
    }
    
    .invoice-items-table {
        font-size: 12px;
    }
    
    .invoice-items-table th,
    .invoice-items-table td {
        padding: 8px;
    }
}

/* ===================== */
/* Utility Classes */
/* ===================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.hidden { display: none !important; }
.visible { display: block !important; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

/* ===================== */
/* Demo Mode Styling */
/* ===================== */

.invoice-preview-content.demo-mode {
    position: relative;
    overflow: hidden;
}

.demo-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    z-index: 10;
    pointer-events: none;
}

.demo-watermark span {
    font-size: 180px;
    font-weight: 900;
    color: rgba(239, 68, 68, 0.15);
    text-transform: uppercase;
    letter-spacing: 30px;
    white-space: nowrap;
    display: block;
    font-family: 'Arial Black', sans-serif;
}

.demo-banner {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
    margin: -30px -30px 30px -30px;
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 14px;
}

.demo-banner i {
    margin-right: 10px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.demo-logo {
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    color: white;
    padding: 20px 30px;
    border-radius: var(--radius);
    font-size: 24px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.demo-logo i {
    font-size: 32px;
}

.demo-tag {
    background: #ef4444;
    color: white;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    margin-left: 10px;
    vertical-align: middle;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.demo-label {
    background: #fef3c7;
    color: #d97706;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: normal;
}

.demo-item-tag {
    background: #fee2e2;
    color: #ef4444;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 5px;
    font-weight: bold;
}

.demo-footer-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px dashed #f59e0b;
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 30px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.demo-footer-warning i {
    font-size: 24px;
    color: #f59e0b;
    flex-shrink: 0;
}

.demo-footer-warning p {
    margin: 0;
    color: #92400e;
    font-size: 13px;
    line-height: 1.6;
}

.demo-disabled {
    opacity: 0.6;
}

.demo-disabled button {
    cursor: not-allowed !important;
}

/* Demo notification bar for dashboard */
.demo-notification-bar {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-bottom: 2px solid #f59e0b;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.demo-notification-bar i {
    color: #f59e0b;
    font-size: 18px;
}

.demo-notification-bar p {
    margin: 0;
    color: #92400e;
    font-size: 14px;
}

.demo-notification-bar strong {
    color: #78350f;
}

.demo-limit-badge {
    background: #ef4444;
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 10px;
}

/* Print styles for demo */
@media print {
    .demo-watermark span {
        font-size: 200px !important;
        color: rgba(239, 68, 68, 0.2) !important;
    }
    
    .demo-banner {
        background: #ef4444 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .demo-footer-warning {
        background: #fef3c7 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
