/* ===========================================================
   InvoicePro - Online Invoice Generator
   Main Stylesheet
   =========================================================== */

/* CSS Variables for Theming */
:root {
    --sidebar-width: 260px;
    --header-height: 60px;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --bg-body: #f8f9fa;
    --bg-sidebar: #1e1e2d;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --border-color: #e9eef2;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

/* Dark Mode */
[data-bs-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --primary-light: #1e1b4b;
}

/* Base Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    color: #a2a3b7;
    z-index: 1040;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--primary);
}

.sidebar-brand:hover { color: #fff; }

.sidebar-user {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.sidebar-nav {
    padding: 15px 0;
}

.sidebar-nav .nav-link {
    color: #a2a3b7;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 0;
    transition: var(--transition);
    position: relative;
}

.sidebar-nav .nav-link i {
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: var(--primary);
}

.nav-divider {
    padding: 20px 20px 8px;
    list-style: none;
}

.nav-divider span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.3);
    font-weight: 600;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Topbar */
.topbar {
    background: var(--bg-card);
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.sidebar-toggle {
    color: var(--text-primary);
    font-size: 1.25rem;
    padding: 0;
    border: none;
    background: none;
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 480px;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.auth-logo {
    text-decoration: none;
    color: var(--text-primary);
}

.auth-logo i {
    font-size: 2.5rem;
    color: var(--primary);
}

.auth-logo h3 {
    margin-top: 10px;
    font-weight: 700;
}

/* Stats Cards */
.stat-card {
    border-radius: var(--radius);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover) !important;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 5px;
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    margin: 0;
    font-size: 1.75rem;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
}

/* Cards */
.card {
    border-radius: var(--radius);
    background: var(--bg-card);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

/* Tables */
.table {
    color: var(--text-primary);
    margin: 0;
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 12px 16px;
}

.table td {
    padding: 12px 16px;
    vertical-align: middle;
    border-color: var(--border-color);
}

.table-hover tbody tr:hover {
    background: var(--primary-light);
}

/* Buttons */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    padding: 8px 20px;
}

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

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

.btn-lg {
    padding: 12px 28px;
    border-radius: var(--radius-sm);
}

/* Forms */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-color);
    padding: 10px 14px;
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

.input-group-text {
    background: var(--bg-body);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Google Button */
.btn-google {
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-google:hover {
    background: #f8f9fa;
    border-color: #dadce0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    color: var(--text-primary);
}

.btn-google i {
    color: #4285f4;
    font-size: 1.2rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 15px;
    font-size: 0.85rem;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
}

/* Client Cards */
.client-card {
    border-radius: var(--radius);
    transition: var(--transition);
}

.client-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover) !important;
}

.client-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
}

.client-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Plan Cards */
.plan-card {
    border-radius: var(--radius);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.plan-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover) !important;
}

.plan-card.popular {
    border: 2px solid var(--primary) !important;
}

.popular-badge {
    position: absolute;
    top: 12px;
    right: -30px;
    background: var(--primary);
    color: #fff;
    padding: 4px 35px;
    font-size: 0.75rem;
    font-weight: 600;
    transform: rotate(45deg);
}

.plan-price {
    margin: 15px 0;
}

.plan-price .currency {
    font-size: 1.5rem;
    vertical-align: top;
    line-height: 1;
}

.plan-price .amount {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.plan-price .period {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.plan-features li {
    padding: 6px 0;
    font-size: 0.9rem;
}

/* Payment Options */
.payment-option {
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    min-width: 120px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.payment-option:hover {
    border-color: var(--primary);
}

.payment-option input:checked + label {
    color: var(--primary);
}

.payment-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* Notifications */
.notification-dropdown {
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    border-radius: var(--radius);
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

/* Landing Page */
.landing-page {
    background: #fff;
}

.hero-section {
    padding: 120px 0 80px;
    background: linear-gradient(135deg, #f8f9fa 0%, #eef2ff 100%);
}

.min-vh-80 {
    min-height: 80vh;
}

.hero-image {
    max-height: 400px;
}

.hero-placeholder {
    border: 2px dashed #dee2e6;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1060;
}

.custom-toast {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    padding: 15px 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--primary);
}

.custom-toast.success { border-left-color: #198754; }
.custom-toast.danger { border-left-color: #dc3545; }
.custom-toast.warning { border-left-color: #ffc107; }
.custom-toast.info { border-left-color: #0dcaf0; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Print Styles */
@media print {
    .sidebar, .topbar, .sidebar-toggle, .btn, .topbar .dropdown { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .card { border: none !important; box-shadow: none !important; }
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.sidebar-open {
        margin-left: var(--sidebar-width);
    }
}

@media (max-width: 767.98px) {
    .auth-card {
        padding: 24px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .plan-price .amount {
        font-size: 2.5rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Ad Banner */
.ad-banner {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ad-banner > * {
    max-width: 100%;
}

/* Template Selector */
.template-option {
    cursor: pointer;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    transition: var(--transition);
    text-align: center;
}
.template-option:hover {
    border-color: var(--primary);
}
.template-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}
.template-option .form-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.template-option .form-check-input {
    margin: 0;
}
.preview-box {
    pointer-events: none;
}
