/* ============================================================================
   JAJ CNC CUT - Apple-Inspired Design System
   Elegant, Minimal, Premium
   ============================================================================ */

/* --------------------------------------------------------------------------
   CSS VARIABLES - Apple Color Palette
   -------------------------------------------------------------------------- */
:root {
    /* Primary Colors */
    --apple-blue: #0071e3;
    --apple-blue-hover: #0077ED;
    --apple-blue-light: rgba(0, 113, 227, 0.1);

    /* Neutral Colors */
    --bg-primary: #fbfbfd;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f7;

    /* Text Colors */
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --text-tertiary: #6e6e73;

    /* Borders & Shadows */
    --border-color: rgba(0, 0, 0, 0.04);
    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-large: 0 12px 40px rgba(0, 0, 0, 0.12);

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.5);

    /* Status Colors */
    --success: #34c759;
    --success-bg: rgba(52, 199, 89, 0.12);
    --warning: #ff9500;
    --warning-bg: rgba(255, 149, 0, 0.12);
    --danger: #ff3b30;
    --danger-bg: rgba(255, 59, 48, 0.12);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 100px;

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Mobile Nav Background */
    --nav-bg-mobile: rgba(255, 255, 255, 0.98);
}

/* --------------------------------------------------------------------------
   BASE STYLES
   -------------------------------------------------------------------------- */
* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

/* Google Places Autocomplete Styling */
.pac-container {
    z-index: 99999 !important;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-medium);
    border: none;
    font-family: inherit;
    margin-top: 4px;
}

.pac-item {
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    border-top: 1px solid var(--border-color);
}

.pac-item:first-child {
    border-top: none;
}

.pac-item:hover {
    background-color: var(--bg-tertiary);
}

.pac-item-query {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.pac-icon {
    margin-right: 12px;
    opacity: 0.6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', 'Helvetica Neue', 'Noto Emoji', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

/* Emoji specific styling */
button {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', 'Helvetica Neue', 'Noto Emoji', sans-serif;
}

/* Selection */
::selection {
    background: var(--apple-blue);
    color: white;
}

/* --------------------------------------------------------------------------
   NAVIGATION - Glass Morphism Style
   -------------------------------------------------------------------------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--border-color);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 var(--space-lg);
    height: 52px;
}

.nav-brand {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    text-decoration: none;
    flex: 0 0 160px;
    transition: opacity var(--transition-fast);
}

.nav-brand:hover {
    opacity: 0.7;
}

.nav-menu {
    list-style: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-xs);
    flex: 1;
    margin: 0;
    padding: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    text-decoration: none;
    padding: var(--space-sm) var(--space-md);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    white-space: nowrap;
    min-height: 32px;
}

/* Hide text labels on desktop, show only icons */
.nav-link .nav-text {
    display: none;
}

.nav-link:hover {
    background: var(--bg-tertiary);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

/* Auth Section */
.nav-auth {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 180px;
    gap: var(--space-sm);
}

#user-info {
    font-size: 12px;
    color: var(--text-secondary);
}

.auth-btn {
    background: var(--apple-blue);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: none;
    /* Hidden by default, shown by JS when needed */
}

.auth-btn:hover {
    background: var(--apple-blue-hover);
    transform: scale(1.02);
}

.auth-btn:active {
    transform: scale(0.98);
}

/* Hamburger Menu Button */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    transition: all var(--transition-fast);
}

.nav-toggle:hover {
    opacity: 0.7;
}

.nav-toggle span {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-smooth);
    transform-origin: center;
}

.nav-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.nav-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   PAGE CONTAINER
   -------------------------------------------------------------------------- */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.page-header h1 {
    margin: 0 0 var(--space-sm) 0;
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--text-primary), var(--text-tertiary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    margin: 0;
    font-size: 17px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* --------------------------------------------------------------------------
   CARDS - Apple Style
   -------------------------------------------------------------------------- */
.apple-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 0.5px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    transition: all var(--transition-smooth);
}

.apple-card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   INVOICE CONTAINER - Premium Paper Style
   -------------------------------------------------------------------------- */
.invoice-container {
    max-width: 900px;
    margin: var(--space-lg) auto;
    background: var(--bg-secondary);
    padding: var(--space-2xl) 60px;
    box-shadow: var(--shadow-large);
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
    animation: scaleIn 0.4s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Watermark */
#watermark {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../Logo.jpeg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 45%;
    opacity: 0.04;
    z-index: 0;
    pointer-events: none;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-xl);
    border-bottom: 0.5px solid var(--border-color);
    position: relative;
    z-index: 1;
}

.logo-container {
    flex-shrink: 0;
}

.logo {
    max-width: 120px;
    height: auto;
    border-radius: var(--radius-sm);
}

.company-info {
    flex: 1;
    padding: 0 var(--space-xl);
}

.company-info h1 {
    margin: 0 0 var(--space-sm) 0;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.company-info p {
    margin: 2px 0;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

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

.invoice-details select {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386868b' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.invoice-details select:hover {
    border-color: var(--apple-blue);
}

.invoice-details select:focus {
    outline: none;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px var(--apple-blue-light);
}

#invoice-number-display {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   INFO CONTAINER
   -------------------------------------------------------------------------- */
.info-container {
    display: flex;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    position: relative;
    z-index: 1;
}

.client-info {
    flex: 1.5;
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 0.5px solid var(--border-color);
}

.client-info p {
    margin: var(--space-sm) 0;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    min-width: 80px;
    flex-shrink: 0;
}

.editable-field {
    flex: 1;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    color: var(--text-primary);
    min-width: 120px;
}

.editable-field:hover {
    background: rgba(0, 0, 0, 0.02);
}

.editable-field:focus {
    outline: none;
    background: var(--bg-secondary);
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px var(--apple-blue-light);
}

/* Client Actions */
.address-input {
    font-family: inherit;
    font-size: 14px;
    font-weight: inherit;
    background: transparent !important;
    border: 1px solid transparent;
    padding: var(--space-xs) var(--space-sm);
    width: 100%;
    margin: 0;
    line-height: inherit;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none !important;
    outline: none !important;
}

.address-input:hover {
    background: rgba(0, 0, 0, 0.02) !important;
}

.address-input:focus {
    background: var(--bg-secondary) !important;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px var(--apple-blue-light) !important;
}

/* Fix for Chrome autocomplete background */
.address-input:-webkit-autofill,
.address-input:-webkit-autofill:hover,
.address-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-tertiary) inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

.client-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 0.5px solid var(--border-color);
}

.client-actions select {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.client-actions select:focus {
    outline: none;
    border-color: var(--apple-blue);
}

/* Date & Status Container */
.date-status-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.date-box {
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 0.5px solid var(--border-color);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-md);
}

.date-field {
    text-align: center;
}

.date-field label,
.status-box label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.date-field input[type="date"] {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
    text-align: center;
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
}

.date-field input[type="date"]:focus {
    outline: none;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px var(--apple-blue-light);
}

.print-date {
    display: none;
}

.status-box {
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 0.5px solid var(--border-color);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.pending {
    background: var(--danger-bg);
    color: var(--danger);
}

.status-badge.paid {
    background: var(--success-bg);
    color: var(--success);
}

/* --------------------------------------------------------------------------
   TABLE - Clean Apple Style
   -------------------------------------------------------------------------- */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: var(--space-xl) 0;
    position: relative;
    z-index: 1;
}

thead {
    background: var(--bg-tertiary);
}

th {
    padding: var(--space-md);
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 0.5px solid var(--border-color);
}

th:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

th:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

td {
    padding: var(--space-md);
    font-size: 14px;
    border-bottom: 0.5px solid var(--border-color);
    vertical-align: middle;
}

.table-editable-content {
    display: block;
    width: 100%;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.table-editable-content:hover {
    background: rgba(0, 0, 0, 0.02);
}

.table-editable-content:focus {
    outline: none;
    background: var(--bg-secondary);
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px var(--apple-blue-light);
}

.delete-row-btn {
    background: var(--danger-bg);
    color: var(--danger);
    border: none;
    border-radius: var(--radius-sm);
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.delete-row-btn:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.1);
}

/* Action Buttons - Apple Pill Style */
.action-buttons-container {
    display: flex;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
    position: relative;
    z-index: 1;
}

.add-row-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.add-row-btn:hover {
    background: var(--text-primary);
    color: white;
}

.action-btn {
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    transform: scale(1.02);
}

.action-btn:active {
    transform: scale(0.98);
}

.save-client-btn,
.delete-client-btn {
    padding: var(--space-sm) var(--space-md);
    font-size: 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.save-client-btn:hover {
    background: var(--success-bg);
}

.delete-client-btn:hover {
    background: var(--danger-bg);
}

/* --------------------------------------------------------------------------
   TOTALS - Clean Layout
   -------------------------------------------------------------------------- */
.totals {
    max-width: 340px;
    margin-left: auto;
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    position: relative;
    z-index: 1;
}

.totals p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: var(--space-sm) 0;
    font-size: 14px;
}

.totals p span:last-child {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    min-width: 100px;
}

.totals .editable-field {
    text-align: right;
    min-width: 100px;
}

.totals .total-line {
    padding-top: var(--space-md);
    margin-top: var(--space-md);
    border-top: 1px solid var(--border-color);
    font-size: 16px;
}

.totals .total-line span {
    font-weight: 700;
}

.totals .balance-line {
    padding-top: var(--space-md);
    margin-top: var(--space-sm);
    border-top: 2px solid var(--text-primary);
    font-size: 17px;
}

.totals .balance-line span {
    font-weight: 700;
}

/* Totals and Payment Terms Container */
.totals-payment-container {
    display: flex;
    gap: var(--space-md);
    align-items: stretch;
    margin-bottom: var(--space-xl);
    position: relative;
}

/* Action Buttons Container */
.action-buttons-container {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-lg);
}

.add-payment-terms-btn {
    background: var(--apple-blue);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.2);
}

.add-payment-terms-btn:hover {
    background: var(--apple-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
}

.add-payment-terms-btn:active {
    transform: translateY(0);
}

.payment-terms-box {
    flex: 1;
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    animation: slideInLeft 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.payment-terms-content {
    font-family: inherit;
    resize: vertical;
    flex: 1;
}

.payment-terms-content:focus {
    background: white;
    border: 1px solid var(--apple-blue);
    box-shadow: 0 0 0 3px var(--apple-blue-light);
}

.payment-terms-content:empty:before {
    content: attr(placeholder);
    color: var(--text-secondary);
    font-style: italic;
}

/* Tax Calculator Styles */
.tax-calculator {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    justify-content: flex-end;
    flex: 1;
}

.tax-rate-field {
    display: inline-block;
    min-width: 30px !important;
    max-width: 50px;
    text-align: center !important;
    padding: 2px 6px !important;
    font-weight: 600;
    color: var(--apple-blue);
    background: var(--apple-blue-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tax-rate-field:hover {
    background: rgba(0, 113, 227, 0.15);
    transform: scale(1.05);
}

.tax-rate-field:focus {
    background: var(--bg-secondary);
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px var(--apple-blue-light);
}

#tax-row {
    position: relative;
}

#tax-row .tax-calculator #total-tax {
    min-width: 100px;
    text-align: right;
    font-weight: 600;
}


/* --------------------------------------------------------------------------
   SIGNATURE
   -------------------------------------------------------------------------- */
.signature-section {
    margin-top: 60px;
    display: flex;
    justify-content: space-between;
    page-break-inside: avoid;
}

.signature-section.centered-signature {
    justify-content: center;
}

.signature-section>div {
    flex: 1;
    text-align: center;
}

.signature-section .line {
    border-bottom: 1px solid var(--text-primary);
    padding: 0 var(--space-lg) var(--space-sm);
    margin: 0 var(--space-lg) var(--space-sm);
    min-height: 50px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.signature-section .role {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 0;
}

/* Footer Note */
.footer-note {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin: var(--space-2xl) 0 0 0;
    padding-top: var(--space-xl);
    border-top: 0.5px solid var(--border-color);
    position: relative;
    z-index: 1;
}

/* --------------------------------------------------------------------------
   FLOATING ACTION BUTTONS
   -------------------------------------------------------------------------- */
.floating-buttons-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 100;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

[data-theme="dark"] .floating-buttons-container {
    background: rgba(30, 30, 30, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

.floating-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.floating-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.2s;
}

.floating-btn:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.floating-btn:hover::before {
    opacity: 1;
}

.floating-btn:active {
    transform: translateY(-2px) scale(0.95);
}

.floating-btn.print {
    background: var(--text-primary);
}

.floating-btn.paid {
    background: var(--success);
}

.floating-btn.save {
    background: var(--apple-blue);
}

.floating-btn.add {
    background: var(--text-secondary);
}

.floating-btn.convert {
    background: #FF9500;
}

.floating-btn.email {
    background: #5856D6;
}

.floating-btn.whatsapp {
    background: #25D366;
}

/* --------------------------------------------------------------------------
   DATA TABLE (List Pages) - Apple Style
   -------------------------------------------------------------------------- */
.search-bar {
    margin-bottom: var(--space-xl);
}

.search-bar input {
    width: 100%;
    max-width: 500px;
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 16px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-soft);
    transition: all var(--transition-fast);
}

.search-bar input:focus {
    outline: none;
    box-shadow: var(--shadow-medium), 0 0 0 3px var(--apple-blue-light);
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

.table-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.data-table thead {
    background: var(--bg-tertiary);
}

.data-table th {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 0.5px solid var(--border-color);
}

.data-table tbody tr {
    transition: all var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table td {
    padding: var(--space-md) var(--space-lg);
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 0.5px solid var(--border-color);
    vertical-align: middle;
}

.data-table .no-data {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

/* Table Action Buttons */
.table-action-btn {
    padding: var(--space-sm) var(--space-md);
    margin: 0 var(--space-xs);
    border: none;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.table-action-btn:hover {
    transform: scale(1.05);
}

.btn-view {
    background: var(--apple-blue-light);
    color: var(--apple-blue);
}

.btn-view:hover {
    background: var(--apple-blue);
    color: white;
}

.btn-edit {
    background: var(--warning-bg);
    color: var(--warning);
}

.btn-edit:hover {
    background: var(--warning);
    color: white;
}

.btn-delete {
    background: var(--danger-bg);
    color: var(--danger);
}

.btn-delete:hover {
    background: var(--danger);
    color: white;
}

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

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

.btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.btn-cancel:hover {
    background: var(--text-secondary);
    color: white;
}

/* --------------------------------------------------------------------------
   SETTINGS GRID
   -------------------------------------------------------------------------- */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
    margin-top: var(--space-xl);
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--border-color);
}

.settings-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.settings-card {
    background: var(--bg-secondary);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 0.5px solid var(--border-color);
    transition: all var(--transition-smooth);
}

.settings-card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.settings-card h2 {
    margin: 0 0 var(--space-sm) 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-card h3 {
    margin: 0 0 var(--space-sm) 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-card p {
    margin: 0 0 var(--space-md) 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.collapsible-content {
    overflow: hidden;
    transition: all 0.3s ease;
}

.settings-input {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
}

.settings-input:hover {
    border-color: var(--text-secondary);
}

.settings-input:focus {
    outline: none;
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px var(--apple-blue-light);
}

.settings-input::placeholder {
    color: var(--text-tertiary);
}


/* Inline Editing */
.editable-cell {
    padding: var(--space-sm);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.editing .editable-cell {
    border-color: var(--apple-blue);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px var(--apple-blue-light);
}

.editing-row {
    background: var(--apple-blue-light) !important;
}

.edit-actions {
    display: none;
    gap: var(--space-xs);
}

.editing .edit-actions {
    display: flex;
}

.editing .view-actions {
    display: none;
}

.filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-tab:hover {
    border-color: var(--apple-blue);
    color: var(--apple-blue);
}

.filter-tab.active {
    background: var(--apple-blue);
    color: white;
    border-color: var(--apple-blue);
}


@media print {
    @page {
        margin: 1cm;
        size: letter;
    }

    body {
        background: white;
        padding: 0 !important;
        margin: 0 !important;
    }

    .invoice-container,
    .quote-container {
        max-width: 100%;
        box-shadow: none;
        border-radius: 0;
        padding: 20px !important;
        margin: 0 !important;
        page-break-after: avoid;
        background: white !important;
    }

    /* Header - keep web styling */
    .header {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        margin-bottom: 20px !important;
        padding-bottom: 15px !important;
        border-bottom: 1px solid #e5e5e7;
    }

    .logo {
        max-width: 80px !important;
    }

    .company-info h1 {
        font-size: 16px !important;
        margin: 0 0 5px 0 !important;
    }

    .company-info p {
        font-size: 11px !important;
        margin: 2px 0 !important;
        line-height: 1.4 !important;
    }

    #invoice-number-display,
    #quote-number-display {
        font-size: 20px !important;
    }

    /* Info container - keep web layout */
    .info-container {
        display: flex !important;
        flex-direction: row !important;
        gap: 15px !important;
        margin-bottom: 15px !important;
    }

    .client-info {
        flex: 1.5 !important;
        padding: 12px 15px !important;
        border-radius: 8px !important;
        background: #f5f5f7 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .date-status-container {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }

    .date-box,
    .status-box {
        padding: 12px 15px !important;
        border-radius: 8px !important;
        background-color: #f5f5f7 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .client-info p {
        margin: 4px 0 !important;
        font-size: 11px !important;
        line-height: 1.4 !important;
    }

    .label {
        font-size: 9px !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
        color: #666 !important;
    }

    /* Table - keep web styling */
    table {
        margin: 15px 0 !important;
        border-spacing: 0 !important;
        width: 100% !important;
    }

    th {
        padding: 10px 12px !important;
        font-size: 10px !important;
        background: #f5f5f7 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    td {
        padding: 10px 12px !important;
        font-size: 11px !important;
    }

    /* Totals and payment terms */
    .totals-payment-container {
        display: flex !important;
        gap: 20px !important;
        align-items: stretch !important;
        page-break-inside: avoid;
    }

    .payment-terms-box {
        flex: 1;
        page-break-inside: avoid;
        display: flex !important;
        flex-direction: column;
        background: #f5f5f7 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .totals {
        padding: 12px 15px !important;
        margin-bottom: 15px !important;
        max-width: 350px !important;
        background: #f5f5f7 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .totals p {
        margin: 5px 0 !important;
        font-size: 11px !important;
        line-height: 1.5 !important;
    }

    .totals .total-line,
    .totals .balance-line {
        font-size: 13px !important;
        margin-top: 8px !important;
        padding-top: 8px !important;
        font-weight: 600 !important;
    }

    /* Signatures */
    .signature-section {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        gap: 40px !important;
        margin-top: 40px !important;
        page-break-inside: avoid;
    }

    #manager-signature,
    #customer-signature {
        flex: 1 !important;
    }

    .signature-section .line {
        min-height: 40px !important;
        padding: 0 15px 8px !important;
        margin: 0 15px 8px !important;
        font-size: 12px !important;
        border-bottom: 2px solid #000 !important;
    }

    .signature-section .role {
        font-size: 11px !important;
        margin: 0 !important;
        text-align: center !important;
        color: #666 !important;
    }

    /* Footer note */
    .footer-note {
        font-size: 11px !important;
        margin: 20px 0 0 0 !important;
        padding-top: 15px !important;
        text-align: center !important;
        border-top: 1px solid #e5e5e7 !important;
        color: #666 !important;
    }

    /* Status badge */
    .status-badge {
        font-size: 11px !important;
        padding: 5px 10px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide UI elements */
    #logo-uploader,
    .add-row-btn,
    .delete-row-btn,
    #due-date-input,
    #invoice-date-input,
    #quote-date-input,
    .action-buttons-container,
    .action-btn,
    .client-actions,
    .save-client-btn,
    #client-selector,
    .delete-client-btn,
    .invoice-management,
    .save-invoice-btn,
    #invoice-selector,
    .delete-invoice-btn,
    #new-invoice-btn,
    .payment-buttons,
    .floating-buttons-container,
    .floating-btn,
    .notification-wrapper,
    .notification-btn,
    .notification-dropdown,
    #document-type-selector,
    .navbar,
    .smart-enhance-btn,
    #file-upload,
    #file-upload-quote,
    .attachments-section {
        display: none !important;
    }

    .print-only {
        display: inline !important;
    }

    .print-date {
        display: block !important;
        text-align: center;
        color: #666;
    }

    .date-field input[type="date"] {
        display: none !important;
    }

    #invoice-number-display,
    #quote-number-display {
        display: inline !important;
        visibility: visible !important;
    }

    #payment-status-display {
        display: inline-block !important;
    }

    .editable-field,
    .table-editable-content {
        border: none !important;
        box-shadow: none !important;
        padding: 2px !important;
    }

    /* Input fields in table for print */
    .table-input,
    div[data-col="description"] {
        border: none !important;
        box-shadow: none !important;
        padding: 2px !important;
        background: transparent !important;
    }

    /* Tax rate field in print */
    .tax-rate-field {
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        color: #000 !important;
        font-size: 11px !important;
    }

    .invoice-container,
    .quote-container {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    #watermark {
        opacity: 0.03;
    }
}

/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 var(--space-md);
    }

    /* Show hamburger button on mobile */
    .nav-toggle {
        display: flex;
        order: 3;
        cursor: pointer;
        z-index: 1010;
        /* Highest priority */
        -webkit-tap-highlight-color: transparent;
        /* Remove tap highlight on iOS */
    }

    /* Hide menu by default on mobile */
    .nav-menu {
        position: fixed;
        top: 52px;
        left: 0;
        right: 0;
        background: var(--nav-bg-mobile);
        /* Almost solid background */
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-bottom: 0.5px solid var(--border-color);
        flex-direction: column;
        gap: 0;
        padding: var(--space-sm) 0;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: all var(--transition-smooth);
        box-shadow: var(--shadow-medium);
        z-index: 1005;
        /* Above auth button */
    }

    /* Show menu when active */
    .nav-menu.active {
        max-height: 300px;
        opacity: 1;
        padding: var(--space-sm) 0;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-link {
        width: 100%;
        padding: var(--space-sm) var(--space-md);
        font-size: 13px;
        font-weight: 500;
        border-radius: 0;
        justify-content: flex-start;
        gap: var(--space-sm);
    }

    .nav-link .material-symbols-rounded {
        font-size: 18px;
    }

    /* Show text labels on mobile */
    .nav-link .nav-text {
        display: inline;
    }

    .nav-brand {
        flex: 1;
        font-size: 14px;
        order: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nav-auth {
        flex: 0 0 auto;
        order: 2;
        margin-right: var(--space-md);
        /* z-index removed/default to let menu cover it */
    }

    .auth-btn {
        padding: 6px 10px;
        font-size: 10px;
    }

    /* Compact page layout for mobile */
    .page-container {
        padding: var(--space-md) var(--space-sm);
    }

    .page-header h1 {
        font-size: 28px;
        margin-bottom: var(--space-xs);
    }

    .page-subtitle {
        font-size: 14px;
    }

    /* Compact dashboard */
    .dashboard-container {
        padding: var(--space-md) var(--space-sm);
    }

    .dashboard-header h1 {
        font-size: 32px;
        margin-bottom: var(--space-xs);
    }

    .dashboard-header p {
        font-size: 14px;
    }

    /* Compact stats grid */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: var(--space-sm);
        margin-bottom: var(--space-lg);
    }

    .stat-card {
        padding: var(--space-md);
        min-height: 120px;
    }

    .stat-label {
        font-size: 9px;
        margin-bottom: 4px;
    }

    .stat-value {
        font-size: 24px;
        margin-bottom: 4px;
    }

    .stat-count {
        font-size: 10px;
    }

    /* Compact action cards */
    .actions-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: var(--space-xs);
    }

    .action-card {
        padding: var(--space-sm) var(--space-md);
        max-width: 100px;
    }

    .action-icon {
        font-size: 22px;
    }

    .action-title {
        font-size: 11px;
    }

    /* Compact filter section */
    .filter-section {
        padding: var(--space-md);
        margin-bottom: var(--space-lg);
    }

    .filter-header h3 {
        font-size: 14px;
    }

    .filter-controls {
        gap: var(--space-sm);
    }

    .filter-group label {
        font-size: 11px;
    }

    .filter-group input[type="date"] {
        padding: 6px 8px;
        font-size: 12px;
    }

    .preset-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    /* Compact invoice container */
    .invoice-container {
        padding: var(--space-md);
        margin: var(--space-sm);
    }

    .info-container {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .header {
        flex-direction: column;
        gap: var(--space-sm);
        padding-bottom: var(--space-md);
        margin-bottom: var(--space-md);
    }

    .company-info {
        padding: var(--space-sm) 0;
    }

    .company-info h1 {
        font-size: 16px;
    }

    .company-info p {
        font-size: 11px;
    }

    .invoice-details {
        text-align: left;
    }

    #invoice-number-display {
        font-size: 22px;
    }

    /* Compact tables */
    table {
        font-size: 12px;
    }

    th {
        padding: var(--space-sm);
        font-size: 10px;
    }

    td {
        padding: var(--space-sm);
        font-size: 12px;
    }

    /* Compact charts */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .chart-card {
        padding: var(--space-md);
    }

    .chart-header h3 {
        font-size: 14px;
    }

    .chart-header p {
        font-size: 11px;
    }

    .chart-container {
        height: 250px;
    }

    /* Compact buttons */
    .action-btn,
    .add-row-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Compact search bar */
    .search-bar input {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Compact settings cards */
    .settings-card {
        padding: var(--space-md);
    }

    .settings-card h2 {
        font-size: 16px;
        margin-bottom: var(--space-sm);
    }

    .settings-card p {
        font-size: 12px;
    }
}


/* ============================================================================
   DARK MODE THEME
   ============================================================================ */

[data-theme="dark"] {
    /* Primary Colors */
    --apple-blue: #0a84ff;
    --apple-blue-hover: #409cff;
    --apple-blue-light: rgba(10, 132, 255, 0.15);

    /* Neutral Colors */
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;

    /* Text Colors */
    --text-primary: #f5f5f7;
    --text-secondary: #98989d;
    --text-tertiary: #8e8e93;

    /* Borders & Shadows */
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-large: 0 12px 40px rgba(0, 0, 0, 0.5);

    /* Glass Effect */
    --glass-bg: rgba(28, 28, 30, 0.72);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Status Colors */
    --success: #30d158;
    --success-bg: rgba(48, 209, 88, 0.2);
    --warning: #ff9f0a;
    --warning-bg: rgba(255, 159, 10, 0.2);
    --danger: #ff453a;
    --danger-bg: rgba(255, 69, 58, 0.2);

    /* Mobile Nav Background */
    --nav-bg-mobile: rgba(28, 28, 30, 0.98);
}

/* Theme Switch Toggle - Day/Night Premium Redesign */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 64px;
    height: 32px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #87CEEB;
    /* Sky Blue (Day) */
    transition: 0.4s;
    border-radius: 34px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 4px;
    background-color: #FFD700;
    /* Sun Yellow */
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 2;
    /* Sun Icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FDB813' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cline x1='12' y1='1' x2='12' y2='3'/%3E%3Cline x1='12' y1='21' x2='12' y2='23'/%3E%3Cline x1='4.22' y1='4.22' x2='5.64' y2='5.64'/%3E%3Cline x1='18.36' y1='18.36' x2='19.78' y2='19.78'/%3E%3Cline x1='1' y1='12' x2='3' y2='12'/%3E%3Cline x1='21' y1='12' x2='23' y2='12'/%3E%3Cline x1='4.22' y1='19.78' x2='5.64' y2='18.36'/%3E%3Cline x1='18.36' y1='5.64' x2='19.78' y2='4.22'/%3E%3C/svg%3E");
    background-size: 70%;
    background-repeat: no-repeat;
    background-position: center;
}

.theme-switch input:checked+.theme-slider {
    background-color: #1a237e;
    /* Deep Navy (Night) */
}

/* Clouds / Stars Decoration */
.theme-switch input:checked+.theme-slider:before {
    transform: translateX(32px);
    background-color: #f5f5f5;
    /* Moon White */
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
    /* Moon Icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23C1C1C1'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'%3E%3C/path%3E%3C/svg%3E");
    background-size: 60%;
}

.theme-slider:hover {
    opacity: 0.9;
}

/* Navbar Theme Toggle Button - Premium Design */
.theme-toggle-btn {
    position: relative;
    width: 64px;
    height: 32px;
    border-radius: 34px;
    border: none;
    background-color: #87CEEB;
    /* Sky Blue (Day) */
    cursor: pointer;
    transition: all 0.4s ease;
    overflow: hidden;
    margin-right: var(--space-md);
    padding: 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-toggle-btn:hover {
    transform: scale(1.05);
}

.theme-toggle-btn::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #FFD700;
    /* Sun Yellow */
    top: 4px;
    left: 4px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 2;
    /* Sun Icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FDB813' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cline x1='12' y1='1' x2='12' y2='3'/%3E%3Cline x1='12' y1='21' x2='12' y2='23'/%3E%3Cline x1='4.22' y1='4.22' x2='5.64' y2='5.64'/%3E%3Cline x1='18.36' y1='18.36' x2='19.78' y2='19.78'/%3E%3Cline x1='1' y1='12' x2='3' y2='12'/%3E%3Cline x1='21' y1='12' x2='23' y2='12'/%3E%3Cline x1='4.22' y1='19.78' x2='5.64' y2='18.36'/%3E%3Cline x1='18.36' y1='5.64' x2='19.78' y2='4.22'/%3E%3C/svg%3E");
    background-size: 70%;
    background-repeat: no-repeat;
    background-position: center;
}

/* Dark Mode State */
[data-theme="dark"] .theme-toggle-btn {
    background-color: #1a237e;
    /* Deep Navy (Night) */
}

[data-theme="dark"] .theme-toggle-btn::before {
    left: calc(100% - 28px);
    background-color: #f5f5f5;
    /* Moon White */
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
    /* Moon Icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23C1C1C1'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'%3E%3C/path%3E%3C/svg%3E");
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center;
}

/* Hide old internal icons since we use pseudo-element backgrounds now */
.theme-toggle-btn .theme-icon {
    display: none;
}

/* iOS Style Switch (Generic) */
.ios-switch {
    display: inline-block;
    position: relative;
    width: 52px;
    height: 30px;
}

.ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ios-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e9e9ea;
    transition: .4s;
    border-radius: 34px;
    border: 1px solid #d1d1d6;
}

.ios-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 1px;
    bottom: 1px;
    background-color: white;
    transition: .4s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06);
}

.ios-switch input:checked+.ios-slider {
    background-color: var(--success);
    /* Apple Green */
    border-color: var(--success);
}

.ios-switch input:checked+.ios-slider:before {
    transform: translateX(22px);
}

/* Dark Mode overrides for iOS switch */
[data-theme="dark"] .ios-slider {
    background-color: #3a3a3c;
    border-color: #48484a;
}

/* ============================================================================
   UI/UX ENHANCEMENTS
   ============================================================================ */

/* Loading States */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: button-loading-spinner 0.6s linear infinite;
    color: white;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }

    to {
        transform: rotate(1turn);
    }
}

/* --------------------------------------------------------------------------
   NOTIFICATION CENTER
   -------------------------------------------------------------------------- */
.notification-wrapper {
    position: relative;
    margin-right: var(--space-md);
    z-index: 1000;
}

.notification-btn {
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition-smooth);
    position: relative;
}

.notification-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--apple-blue);
    transform: translateY(-2px);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-primary);
}

.notification-dropdown {
    position: absolute;
    top: 50px;
    right: -80px;
    width: 320px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
    opacity: 0;
    display: none;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1001;
    overflow: hidden;
}

.notification-dropdown.active {
    opacity: 1;
    display: block;
    transform: translateY(0);
    pointer-events: all;
}

/* Mobile adjustments for notifications */
@media (max-width: 768px) {
    .notification-dropdown {
        position: fixed;
        top: 70px;
        left: 50%;
        transform: translateX(-50%) translateY(10px);
        right: auto;
        width: 90%;
        max-width: 350px;
    }

    .notification-dropdown.active {
        transform: translateX(-50%) translateY(0);
    }
}

.notification-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
}

.notification-header h3 {
    font-size: 14px;
    margin: 0;
    font-weight: 600;
}

.clear-all-btn {
    background: none;
    border: none;
    color: var(--apple-blue);
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    padding: var(--space-md);
    display: flex;
    gap: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.notification-item:hover {
    background: var(--bg-tertiary);
}

.notification-item.warning .notification-icon {
    color: var(--danger);
    background: rgba(231, 76, 60, 0.1);
}

.notification-item.alert .notification-icon {
    color: var(--warning);
    background: rgba(241, 196, 15, 0.1);
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-content h4 {
    margin: 0 0 4px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.notification-content p {
    margin: 0 0 4px 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notification-content .time {
    font-size: 10px;
    color: var(--text-tertiary);
}

.empty-state {
    padding: var(--space-xl);
    text-align: center;
    color: var(--text-tertiary);
}

.empty-state span {
    font-size: 32px;
    margin-bottom: var(--space-sm);
    display: block;
}

/* Success Animation */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.success-checkmark .check-icon {
    width: 80px;
    height: 80px;
    position: relative;
    border-radius: 50%;
    box-sizing: content-box;
    border: 4px solid #34c759;
}

.success-checkmark .check-icon::before {
    top: 3px;
    left: -2px;
    width: 30px;
    transform-origin: 100% 50%;
    border-radius: 100px 0 0 100px;
}

.success-checkmark .check-icon::after {
    top: 0;
    left: 30px;
    width: 60px;
    transform-origin: 0 50%;
    border-radius: 0 100px 100px 0;
    animation: rotate-circle 4.25s ease-in;
}

.success-checkmark .check-icon::before,
.success-checkmark .check-icon::after {
    content: '';
    height: 100px;
    position: absolute;
    background: white;
    transform: rotate(-45deg);
}

.success-checkmark .check-icon .icon-line {
    height: 5px;
    background-color: #34c759;
    display: block;
    border-radius: 2px;
    position: absolute;
    z-index: 10;
}

.success-checkmark .check-icon .icon-line.line-tip {
    top: 46px;
    left: 14px;
    width: 25px;
    transform: rotate(45deg);
    animation: icon-line-tip 0.75s;
}

.success-checkmark .check-icon .icon-line.line-long {
    top: 38px;
    right: 8px;
    width: 47px;
    transform: rotate(-45deg);
    animation: icon-line-long 0.75s;
}

@keyframes rotate-circle {
    0% {
        transform: rotate(-45deg);
    }

    5% {
        transform: rotate(-45deg);
    }

    12% {
        transform: rotate(-405deg);
    }

    100% {
        transform: rotate(-405deg);
    }
}

@keyframes icon-line-tip {
    0% {
        width: 0;
        left: 1px;
        top: 19px;
    }

    54% {
        width: 0;
        left: 1px;
        top: 19px;
    }

    70% {
        width: 50px;
        left: -8px;
        top: 37px;
    }

    84% {
        width: 17px;
        left: 21px;
        top: 48px;
    }

    100% {
        width: 25px;
        left: 14px;
        top: 45px;
    }
}

@keyframes icon-line-long {
    0% {
        width: 0;
        right: 46px;
        top: 54px;
    }

    65% {
        width: 0;
        right: 46px;
        top: 54px;
    }

    84% {
        width: 55px;
        right: 0px;
        top: 35px;
    }

    100% {
        width: 47px;
        right: 8px;
        top: 38px;
    }
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 120px;
    border-radius: 12px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Smooth Transitions */
.smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.02);
}

/* Pulse Animation */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Fade In Animation */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In Animation */
.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-large);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: slideInRight 0.3s ease-out;
    border: 1px solid var(--border-color);
}

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

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

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast-icon {
    font-size: 24px;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 20px;
    line-height: 1;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Improved Button States */
button:not(:disabled):active,
.action-btn:not(:disabled):active {
    transform: scale(0.98);
}

button:disabled,
.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Focus Visible (Accessibility) */
*:focus-visible {
    outline: 2px solid var(--apple-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Selection */
::selection {
    background-color: var(--apple-blue-light);
    color: var(--apple-blue);
}

/* Improved Input Focus */
input:focus,
textarea:focus,
select:focus {
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px var(--apple-blue-light);
    outline: none;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--apple-blue);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ============================================================================
   RESPONSIVE DESIGN - Mobile & Tablet
   ============================================================================ */

/* Tablet (iPad) */
@media (max-width: 1024px) {
    .nav-menu {
        gap: 15px;
    }

    .dashboard-container,
    .container {
        padding: var(--space-lg);
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

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

    /* Hide floating buttons on tablets/mobile except Paid */
    #floating-save-btn,
    #floating-new-btn,
    #floating-convert-btn,
    #floating-pdf-btn,
    #floating-print-btn,
    #floating-email-btn,
    #floating-whatsapp-btn {
        display: none !important;
    }

    /* Ensure paid button is visible and positioned correctly */
    #floating-paid-btn {
        bottom: 24px;
        display: flex !important;
    }

}

/* Mobile (iPhone) */
@media (max-width: 768px) {

    /* Increase base font size for mobile */
    body {
        font-size: 16px;
    }




    .invoice-container,
    .quote-container {
        font-size: 16px;
    }

    h1 {
        font-size: 32px;
    }

    h2 {
        font-size: 24px;
    }

    .navbar {
        padding: 20px 0;
    }

    .nav-menu {
        gap: 16px;
        font-size: 17px;
    }

    .nav-link span {
        font-size: 28px;
    }

    .nav-brand {
        font-size: 22px;
        font-weight: 700;
    }

    .dashboard-container,
    .container {
        padding: var(--space-lg);
    }

    .dashboard-header h1 {
        font-size: 36px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .stat-card {
        min-height: 140px;
        padding: var(--space-xl);
    }

    .stat-value {
        font-size: 32px;
    }

    .stat-label {
        font-size: 14px;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .chart-card {
        min-height: 300px;
    }

    .actions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }

    .action-card {
        padding: var(--space-lg);
        max-width: none;
    }

    .action-icon {
        font-size: 32px;
    }

    .action-title {
        font-size: 14px;
        font-weight: 600;
    }

    /* Invoice/Quote Forms */
    .invoice-header {
        flex-direction: column;
        gap: var(--space-md);
    }

    .client-info,
    .invoice-info {
        width: 100%;
    }

    .items-table {
        font-size: 16px;
    }

    .items-table th,
    .items-table td {
        padding: 12px 8px;
    }

    /* Hide some columns on mobile */
    .items-table .hide-mobile {
        display: none;
    }

    .totals-section {
        width: 100%;
    }

    /* Settings */
    .settings-grid {
        grid-template-columns: 1fr;
    }

    /* Filter section */
    .filter-controls {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .filter-presets {
        flex-wrap: wrap;
    }

    .preset-btn {
        flex: 1 1 45%;
        min-width: 100px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .nav-menu {
        gap: 4px;
    }

    .nav-link {
        padding: 6px 8px;
    }

    .dashboard-header h1 {
        font-size: 24px;
    }

    .stat-value {
        font-size: 24px;
    }

    .actions-grid {
        grid-template-columns: 1fr;
    }

    .action-card {
        max-width: none;
    }
}

/* Landscape Mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Print Styles */
@media print {

    /* Force light mode for print */
    body {
        background: white !important;
        color: black !important;
    }

    body.dark-mode {
        background: white !important;
        color: black !important;
    }

    /* Override all dark mode variables for print */
    body.dark-mode,
    body {
        --bg-primary: #ffffff !important;
        --bg-secondary: #f5f5f7 !important;
        --bg-tertiary: #ffffff !important;
        --text-primary: #000000 !important;
        --text-secondary: #666666 !important;
        --border-color: #d1d1d6 !important;
    }

    /* Force light backgrounds and dark text */
    .invoice-container,
    .quote-container,
    .header,
    .client-info,
    .invoice-info,
    .items-table,
    .totals-section,
    .signature-section,
    .footer-note {
        background: white !important;
        color: black !important;
    }

    .items-table th,
    .items-table td {
        background: white !important;
        color: black !important;
        border-color: #d1d1d6 !important;
    }

    .items-table thead {
        background: #f5f5f7 !important;
        color: black !important;
    }

    /* Apply 115% zoom for print */
    .invoice-container,
    .quote-container {
        transform: scale(1.15);
        transform-origin: top left;
        width: 86.96%;
        /* 100% / 1.15 to compensate for scale */
        margin-top: 40px;
        padding-top: 20px;
    }

    /* Watermark on each page */
    #watermark {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-image: url('../Logo.jpeg');
        background-repeat: no-repeat;
        background-position: center;
        background-size: 45%;
        opacity: 0.04;
        z-index: -1;
        pointer-events: none;
    }

    /* Hide UI elements */
    .navbar,
    .filter-section,
    .quick-actions,
    .action-btn,
    .nav-auth,
    .delete-row-btn,
    .smart-enhance-btn,
    .floating-buttons-container,
    .floating-btn,
    .notification-wrapper,
    .notification-btn,
    .notification-dropdown,
    #file-upload,
    #file-upload-quote,
    .attachments-section h3,
    .attachments-section p,
    .attachments-section>div:first-of-type,
    .add-payment-terms-btn,
    .action-buttons-container {
        display: none !important;
    }

    /* Maintain payment terms layout in print */
    .totals-payment-container {
        display: flex !important;
        gap: 16px;
        align-items: stretch;
        page-break-inside: avoid;
    }

    .payment-terms-box {
        flex: 1;
        page-break-inside: avoid;
        display: flex !important;
        flex-direction: column;
    }

    .totals {
        max-width: 340px;
        flex-shrink: 0;
    }

    /* Maintain gray backgrounds in print */
    .client-info,
    .invoice-info,
    .totals,
    .payment-terms-box,
    thead {
        background: #f5f5f7 !important;
        border: 1px solid #e5e5e7 !important;
    }

    .payment-terms-content {
        background: #f5f5f7 !important;
    }

    body {
        background: white;
        color: black;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .invoice-container,
    .quote-container {
        box-shadow: none;
        border: none;
    }

    /* Push signatures to bottom of page */
    .signature-section {
        margin-top: 80px !important;
        padding-top: 80px !important;
        page-break-inside: avoid;
        page-break-after: auto;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-around !important;
        gap: 100px !important;
    }

    #manager-signature,
    #customer-signature {
        flex: 1 !important;
        max-width: 350px !important;
    }

    .signature-section .line {
        min-height: 50px !important;
        padding: 0 20px 12px !important;
        margin: 0 0 12px !important;
        font-weight: 600 !important;
        border-bottom: 2px solid #000 !important;
    }

    .signature-section .role {
        font-weight: 500 !important;
        color: #000 !important;
        text-align: center !important;
    }

    /* Footer note before signatures */
    .footer-note {
        margin-top: 40px;
        margin-bottom: 30px;
    }

    /* Hide attachments section completely in print */
    .attachments-section {
        display: none !important;
    }

    /* Show only print-friendly images on new page */
    .print-only {
        display: block !important;
        page-break-before: always;
        page-break-inside: avoid;
    }

    #attachments-list,
    #attachments-list-quote {
        display: none !important;
    }

    /* Print images inline */
    .print-attachment-image {
        max-width: 100%;
        max-height: 400px;
        margin: 10px 0;
        border: none;
        page-break-inside: avoid;
    }

    /* Reset padding on description input for print */
    td div input.table-input {
        padding-right: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        /* Allow shrinking if needed, but width 100% should fill td */
        white-space: pre-wrap !important;
        /* Attempt to wrap if possible, though inputs don't usually wrap */
        overflow: visible !important;
    }
}

/* Ensure content sits above background */
.app-container {
    position: relative;
    z-index: 1;
}

/* --------------------------------------------------------------------------
   ANIMATED BACKGROUND (Apple Style Aurora)
   -------------------------------------------------------------------------- */
.dashboard-body {
    background: transparent !important;
}

.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    /* Changed from -1 to 0 */
    overflow: hidden;
    background: #ffffff;
    /* Pure white base */
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    /* Reduced blur slightly */
    opacity: 0.8;
    /* Increased opacity from 0.5 */
    animation: aurora-float 20s infinite ease-in-out alternate;
}

/* Blue Orb */
.blob-1 {
    top: -10%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(0, 113, 227, 0.4) 0%, rgba(0, 113, 227, 0) 70%);
    /* More opacity */
    animation-delay: 0s;
}

/* Purple/Mint Orb */
.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 70vw;
    height: 70vw;
    background: radial-gradient(circle, rgba(52, 199, 89, 0.3) 0%, rgba(175, 82, 222, 0.2) 70%);
    animation-delay: -5s;
    animation-direction: alternate-reverse;
}

/* Warm Orb */
.blob-3 {
    top: 30%;
    left: 30%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(255, 149, 0, 0.3) 0%, rgba(255, 59, 48, 0.1) 70%);
    animation-delay: -10s;
}

@keyframes aurora-float {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1) rotate(10deg);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9) rotate(-5deg);
    }

    100% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
}

/* --------------------------------------------------------------------------
   DARK MODE ANIMATION OVERRIDES (Night Sky Theme)
   -------------------------------------------------------------------------- */
[data-theme="dark"] .animated-background {
    background: #050505;
    /* Almost black */
}

[data-theme="dark"] .blob {
    opacity: 0.7;
    /* Higher opacity but darker colors */
    filter: blur(90px);
    /* Max blur for nebula effect */
}

/* Dark Mode Blue Orb (Midnight Blue) */
[data-theme="dark"] .blob-1 {
    background: radial-gradient(circle, rgba(14, 25, 60, 0.8) 0%, rgba(14, 25, 60, 0) 70%);
}

/* Dark Mode Purple (Cosmic Purple) */
[data-theme="dark"] .blob-2 {
    background: radial-gradient(circle, rgba(30, 15, 50, 0.8) 0%, rgba(30, 15, 50, 0) 70%);
}

/* Dark Mode Indigo (Deep Space) - Replaces Orange */
[data-theme="dark"] .blob-3 {
    background: radial-gradient(circle, rgba(10, 20, 40, 0.9) 0%, rgba(10, 20, 40, 0) 70%);
}

/* Custom Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--bg-secondary);
    width: 90%;
    max-width: 400px;
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-large);
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-btn.cancel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-btn.cancel:hover {
    background: #e5e5ea;
}

.modal-btn.confirm {
    background: var(--danger);
    color: white;
}

.modal-btn.confirm:hover {
    background: #d63a2f;
}

.modal-btn.primary {
    background: var(--apple-blue);
    color: white;
}

.modal-btn.primary:hover {
    background: #0071e3;
}

/* --------------------------------------------------------------------------
   AUTHENTICATION GATE
   -------------------------------------------------------------------------- */
.auth-gate-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    overflow: hidden;
}

/* Animated background (same as dashboard) */
.auth-gate-overlay::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(0, 122, 255, 0.1), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(88, 86, 214, 0.1), transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(52, 199, 89, 0.08), transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -30px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

.auth-gate-content {
    position: relative;
    z-index: 1;
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-gate-content h1 {
    font-size: 72px;
    font-weight: 700;
    letter-spacing: -0.04em;
    margin: 0 0 var(--space-2xl) 0;
    background: linear-gradient(135deg, var(--text-primary), var(--apple-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#auth-gate-signin {
    padding: 16px 48px;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--apple-blue), #0066cc);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-smooth);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

#auth-gate-signin:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.4);
}

#auth-gate-signin:active {
    transform: translateY(0) scale(0.98);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .auth-gate-content h1 {
        font-size: 48px;
    }

    #auth-gate-signin {
        padding: 14px 36px;
        font-size: 16px;
    }
}

/* --------------------------------------------------------------------------
   ADMIN PANEL ANIMATIONS
   -------------------------------------------------------------------------- */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--apple-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}