/* Import Outfit Font */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* Reset and Variables */
:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-sidebar: #0f172a;
    --border-color: rgba(255, 255, 255, 0.06);
    --border-focus: #6366f1;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    
    --accent: #06b6d4;
    --accent-hover: #0891b2;
    --accent-light: rgba(6, 182, 212, 0.1);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(120deg, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
}

.nav-item a:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active a {
    color: #fff;
    background: linear-gradient(90deg, var(--primary-light), transparent);
    border-left: 3px solid var(--primary);
}

.nav-icon {
    font-size: 1.2rem;
}

.user-profile {
    margin-top: auto;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background-color: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.username {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content Styling */
.main-content {
    margin-left: 260px;
    flex-grow: 1;
    padding: 40px;
    min-height: 100vh;
}

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

.header-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.header-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Metrics Dashboard Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.metric-card.accent::before {
    background: var(--accent);
}

.metric-card:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: var(--shadow-glow);
}

.metric-card.accent:hover {
    border-color: rgba(6, 182, 212, 0.2);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
}

.metric-info h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    margin-bottom: 6px;
}

.metric-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.metric-icon-box {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.metric-card.accent .metric-icon-box {
    background-color: var(--accent-light);
    color: var(--accent);
}

/* Dashboard Summary Layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1.6fr 1.2fr;
    gap: 24px;
}

.panel-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(10px);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Table Design */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    padding: 12px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-primary);
    vertical-align: middle;
}

.custom-table tr {
    transition: var(--transition);
}

.custom-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background-color: var(--success-light);
    color: var(--success);
}

.badge-info {
    background-color: var(--accent-light);
    color: var(--accent);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: #fff;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-accent {
    background-color: var(--accent);
}

.btn-accent:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-danger {
    background-color: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.btn-danger:hover {
    background-color: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 4px;
}

/* Authentication Page Styles (Login & Signup) */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
                var(--bg-main);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.auth-card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: var(--shadow-glow);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header .logo-icon {
    margin: 0 auto 16px auto;
}

.auth-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #fff;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Alert Boxes */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.alert-danger {
    background-color: var(--danger-light);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.alert-success {
    background-color: var(--success-light);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

/* Forms general */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-select {
    width: 100%;
    background-color: #0b0f19;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.form-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Modal and Forms */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    background-color: rgba(0, 0, 0, 0.15);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Search and Filters */
.search-container {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.search-input-wrapper {
    position: relative;
    flex-grow: 1;
}

.search-input {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px 12px 42px;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Invoice Specific Layout */
.invoice-container {
    background-color: #fff;
    color: #1e293b;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px;
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Outfit', sans-serif;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 32px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 32px;
}

.invoice-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.invoice-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
}

.invoice-logo-text {
    font-weight: 700;
    font-size: 1.4rem;
    color: #0f172a;
}

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

.invoice-meta h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.invoice-meta p {
    color: #64748b;
    font-size: 0.9rem;
}

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

.invoice-address-block h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin-bottom: 12px;
}

.invoice-address-block p {
    font-size: 0.95rem;
    line-height: 1.5;
}

.invoice-address-block strong {
    color: #0f172a;
    font-size: 1.05rem;
}

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

.invoice-table th {
    background-color: #f8fafc;
    padding: 12px 16px;
    color: #475569;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

.invoice-table td {
    padding: 16px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.95rem;
}

.invoice-table tr:last-child td {
    border-bottom: none;
}

.invoice-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.invoice-total-row {
    display: flex;
    justify-content: space-between;
    width: 250px;
    font-size: 0.95rem;
}

.invoice-total-row.grand-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    border-top: 1px solid #edf2f7;
    padding-top: 8px;
}

.invoice-footer {
    text-align: center;
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
    color: #94a3b8;
    font-size: 0.85rem;
}

/* Actions in Invoice View (for browser control) */
.invoice-actions-bar {
    max-width: 800px;
    margin: 24px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

/* Print Overrides */
@media print {
    body {
        background-color: #fff !important;
        color: #000 !important;
    }
    
    .sidebar,
    .invoice-actions-bar,
    .header-container,
    .nav-links,
    .btn {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .invoice-container {
        box-shadow: none !important;
        padding: 0 !important;
        max-width: 100% !important;
        background-color: transparent !important;
    }
}
