/* ===== Invoice AI — Shared Styles ===== */
/* Ported from Executor 101 heavenly theme */

/* ===== CSS Variables ===== */
:root {
    /* Heavenly Color Palette — Light Yellow & Light Blue */
    --primary-yellow: #FFF9E6;
    --secondary-yellow: #FFF3CC;
    --accent-yellow: #FFE599;
    --warm-yellow: #FFD966;

    --primary-blue: #E8F4FD;
    --secondary-blue: #D0E8F9;
    --accent-blue: #A8D4F0;
    --deep-blue: #7EC4E8;

    /* Neutral Colors */
    --text-primary: #2D3748;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --white: #FFFFFF;
    --border-light: rgba(166, 196, 214, 0.3);

    /* Gradients */
    --gradient-heaven: linear-gradient(135deg, var(--primary-yellow) 0%, var(--primary-blue) 50%, var(--secondary-yellow) 100%);
    --gradient-soft: linear-gradient(180deg, var(--primary-blue) 0%, var(--primary-yellow) 100%);
    --gradient-sidebar: linear-gradient(180deg, var(--secondary-blue) 0%, var(--primary-blue) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-blue) 0%, var(--deep-blue) 100%);
    --gradient-warm: linear-gradient(135deg, var(--accent-yellow) 0%, var(--warm-yellow) 100%);

    /* Shadows */
    --shadow-soft: 0 4px 20px rgba(166, 196, 214, 0.2);
    --shadow-medium: 0 8px 30px rgba(166, 196, 214, 0.3);
    --shadow-glow: 0 0 40px rgba(166, 196, 214, 0.4);
    --shadow-card: 0 10px 40px rgba(126, 196, 232, 0.15);

    /* Spacing */
    --sidebar-width: 280px;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --border-radius-lg: 20px;

    /* Transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gradient-heaven);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
}

/* ===== Layout ===== */
.container {
    display: flex;
    width: 100%;
    height: 100vh;
    gap: 20px;
    padding: 20px;
    position: relative;
}

/* ===== Floating Clouds (Decorative) ===== */
.cloud {
    position: fixed;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 100px;
    filter: blur(45px);
    pointer-events: none;
    z-index: 0;
}

.cloud-1 {
    width: 420px;
    height: 200px;
    top: -50px;
    right: 10%;
    animation: cloudFloat 20s ease-in-out infinite;
}

.cloud-2 {
    width: 320px;
    height: 150px;
    bottom: 18%;
    left: 5%;
    animation: cloudFloat 25s ease-in-out infinite reverse;
}

.cloud-3 {
    width: 360px;
    height: 180px;
    top: 42%;
    right: -5%;
    animation: cloudFloat 22s ease-in-out infinite;
}

@keyframes cloudFloat {
    0%, 100% { transform: translateX(0) translateY(0); }
    25%  { transform: translateX(20px) translateY(-10px); }
    50%  { transform: translateX(-10px) translateY(5px); }
    75%  { transform: translateX(15px) translateY(-5px); }
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gradient-sidebar);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-medium);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    border: 1px solid var(--border-light);
    animation: slideInLeft 0.5s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.logo {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.logo h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--deep-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.logo h1 i {
    -webkit-text-fill-color: var(--deep-blue);
    margin-right: 6px;
}

.logo p {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* Navigation */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    padding: 14px 18px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: var(--white);
    color: var(--text-primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-soft);
    border-color: var(--border-light);
}

.nav-item.active {
    background: var(--gradient-accent);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(126, 196, 232, 0.4);
    border-color: transparent;
}

.nav-item.active i {
    color: var(--white);
}

.nav-item .icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.nav-item .icon i {
    transition: var(--transition-smooth);
}

.nav-item:hover .icon i {
    transform: scale(1.15);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    overflow-y: auto;
    box-shadow: var(--shadow-medium);
    position: relative;
    z-index: 5;
    border: 1px solid var(--border-light);
    animation: fadeInUp 0.6s ease-out;
}

/* ===== Page Animations ===== */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-light);
}

.page-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--deep-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header h2 i {
    -webkit-text-fill-color: var(--deep-blue);
    margin-right: 10px;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Connection Card (Email page) ===== */
.connection-card {
    background: var(--gradient-accent);
    padding: 24px;
    border-radius: var(--border-radius);
    color: var(--white);
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(126, 196, 232, 0.35);
    transition: var(--transition-smooth);
}

.connection-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(126, 196, 232, 0.45);
}

.connection-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.connection-card .status {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--accent-yellow);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-yellow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.15); }
}

.connection-card .account-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: var(--border-radius-sm);
    backdrop-filter: blur(10px);
    transition: var(--transition-smooth);
}

.connection-card .account-info:hover {
    background: rgba(255, 255, 255, 0.28);
}

.connection-card .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--deep-blue);
    box-shadow: var(--shadow-soft);
}

.connection-card .account-details h4 {
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.connection-card .account-details p {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* ===== Email Cards ===== */
.email-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.email-card {
    background: var(--white);
    padding: 18px 20px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
}

.email-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
    border-color: var(--accent-blue);
}

.email-card .email-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.email-card .sender {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.email-card .date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.email-card .subject {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.email-card .invoice-count {
    display: inline-block;
    background: var(--gradient-accent);
    color: var(--white);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.email-card:hover .invoice-count {
    box-shadow: 0 2px 8px rgba(126, 196, 232, 0.4);
}

/* ===== Upload Zone ===== */
.upload-zone {
    border: 3px dashed var(--accent-blue);
    border-radius: var(--border-radius);
    padding: 55px 40px;
    text-align: center;
    margin-bottom: 25px;
    transition: var(--transition-smooth);
    background: rgba(232, 244, 253, 0.3);
    cursor: pointer;
}

.upload-zone:hover {
    border-color: var(--deep-blue);
    background: rgba(232, 244, 253, 0.5);
    transform: scale(1.01);
    box-shadow: var(--shadow-glow);
}

.upload-zone.dragover {
    border-color: var(--warm-yellow);
    background: rgba(255, 249, 230, 0.5);
    box-shadow: 0 0 30px rgba(255, 217, 102, 0.3);
}

.upload-zone .upload-icon {
    font-size: 56px;
    margin-bottom: 18px;
    color: var(--deep-blue);
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.upload-zone h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-zone p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ===== Buttons ===== */
.btn-upload {
    background: var(--gradient-accent);
    color: var(--white);
    border: none;
    padding: 12px 28px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 14px;
    transition: var(--transition-bounce);
    box-shadow: 0 4px 15px rgba(126, 196, 232, 0.35);
}

.btn-upload:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(126, 196, 232, 0.5);
}

.file-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    background: var(--gradient-accent);
    color: var(--white);
    border: none;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-bounce);
}

.btn-action:hover {
    transform: scale(1.08);
    box-shadow: 0 3px 12px rgba(126, 196, 232, 0.4);
}

.btn-action.download {
    background: var(--gradient-warm);
    color: var(--text-primary);
}

.btn-action.download:hover {
    box-shadow: 0 3px 12px rgba(255, 217, 102, 0.5);
}

.btn-action.delete {
    background: linear-gradient(135deg, #F6A0A0 0%, #E57373 100%);
}

.btn-action.delete:hover {
    box-shadow: 0 3px 12px rgba(229, 115, 115, 0.5);
}

.btn-fetch {
    background: linear-gradient(135deg, var(--accent-yellow) 0%, var(--warm-yellow) 100%);
    color: var(--text-primary);
    border: none;
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-bounce);
}

.btn-fetch:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 15px rgba(255, 217, 102, 0.5);
}

.btn-send {
    background: var(--gradient-accent);
    color: var(--white);
    border: none;
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-bounce);
}

.btn-send:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 15px rgba(126, 196, 232, 0.5);
}

/* ===== Stats Grid (History page) ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--gradient-accent);
    padding: 24px;
    border-radius: var(--border-radius);
    color: var(--white);
    box-shadow: 0 8px 25px rgba(126, 196, 232, 0.3);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(126, 196, 232, 0.45);
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-card p {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* ===== History Grid ===== */
.history-grid {
    display: grid;
    gap: 12px;
}

.history-item {
    background: rgba(255, 255, 255, 0.7);
    padding: 18px 20px;
    border-radius: var(--border-radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
    border: 1px solid var(--border-light);
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-soft);
    background: var(--white);
}

.history-item .file-info h4 {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.history-item .file-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.status-badge.success {
    background: rgba(168, 212, 240, 0.25);
    color: var(--deep-blue);
    border: 1px solid rgba(126, 196, 232, 0.3);
}

.status-badge.processing {
    background: rgba(255, 229, 153, 0.3);
    color: #92400e;
    border: 1px solid rgba(255, 217, 102, 0.4);
    animation: pulse 2s infinite;
}

/* ===== Xero Page ===== */
.zero-connection {
    background: rgba(255, 255, 255, 0.6);
    padding: 24px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
}

.zero-connection h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.connection-status .indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-yellow);
    box-shadow: 0 0 10px var(--accent-yellow);
    animation: pulse 2s infinite;
}

.xero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

.xero-section {
    background: rgba(255, 255, 255, 0.5);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
}

.xero-section h3 {
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

.xero-section h3 i {
    color: var(--deep-blue);
}

.queue-item {
    background: var(--white);
    padding: 14px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
    border: 1px solid var(--border-light);
}

.queue-item:hover {
    box-shadow: var(--shadow-soft);
    transform: translateX(3px);
}

.queue-item .invoice-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.fetched-data {
    background: var(--white);
    padding: 14px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 10px;
    border-left: 4px solid var(--deep-blue);
    transition: var(--transition-smooth);
}

.fetched-data:hover {
    box-shadow: var(--shadow-soft);
    transform: translateX(3px);
}

.fetched-data h4 {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 600;
}

.fetched-data p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.fetched-data .data-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.8rem;
}

.fetched-data .data-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.fetched-data .data-value {
    color: var(--text-muted);
}

/* ===== Dividers ===== */
.section-divider {
    margin: 35px 0;
    border-top: 1px solid var(--border-light);
}

/* ===== File Input ===== */
input[type="file"] {
    display: none;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--deep-blue);
}

/* ===== Stagger Animation for Lists ===== */
.email-card,
.history-item,
.queue-item,
.fetched-data {
    animation: fadeInUp 0.4s ease-out backwards;
}

.email-card:nth-child(1), .history-item:nth-child(1), .queue-item:nth-child(1), .fetched-data:nth-child(1) { animation-delay: 0.05s; }
.email-card:nth-child(2), .history-item:nth-child(2), .queue-item:nth-child(2), .fetched-data:nth-child(2) { animation-delay: 0.10s; }
.email-card:nth-child(3), .history-item:nth-child(3), .queue-item:nth-child(3), .fetched-data:nth-child(3) { animation-delay: 0.15s; }
.email-card:nth-child(4), .history-item:nth-child(4), .queue-item:nth-child(4), .fetched-data:nth-child(4) { animation-delay: 0.20s; }
.email-card:nth-child(5), .history-item:nth-child(5), .queue-item:nth-child(5), .fetched-data:nth-child(5) { animation-delay: 0.25s; }
.email-card:nth-child(6), .history-item:nth-child(6) { animation-delay: 0.30s; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 14px 18px;
        border-radius: var(--border-radius);
        gap: 12px;
    }

    .logo {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .logo p { display: none; }

    .nav-menu {
        flex-direction: row;
        gap: 6px;
        flex: 1;
        overflow-x: auto;
    }

    .nav-item {
        padding: 10px 14px;
        white-space: nowrap;
        font-size: 0.85rem;
    }

    .nav-item span:not(.icon) {
        display: none;
    }

    .main-content {
        padding: 20px;
        overflow-y: auto;
    }

    .xero-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-header h2 {
        font-size: 1.3rem;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-card h3 {
        font-size: 1.5rem;
    }

    .upload-zone {
        padding: 35px 20px;
    }
}
