/* 
 * Premium Invoice Generator Styles
 * World-class UI/UX with stunning animations and modern design
 */

:root {
    /* Premium Color Palette */
    --primary: #2A3B8F;
    --primary-light: #3B4FA3;
    --primary-dark: #1E2A6B;
    --secondary: #2B68C1;
    --accent: #6366F1;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;
    
    /* Neutral Colors */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
    --gradient-accent: linear-gradient(135deg, var(--accent), var(--primary-light));
    --gradient-success: linear-gradient(135deg, var(--success), #059669);
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    
    /* Shadows */
    --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-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 20px rgba(42, 59, 143, 0.3);
    
    /* Typography */
    --font-display: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease-out;
    --transition-normal: 0.3s ease-out;
    --transition-slow: 0.5s ease-out;
}

/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--gray-800);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
}

/* Premium Glass Morphism Effects */
.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-xl);
    transition: all var(--transition-normal);
}

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

/* Premium Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    font-family: var(--font-body);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left var(--transition-slow);
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--gradient-accent);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

.btn-ghost {
    background: rgba(42, 59, 143, 0.1);
    color: var(--primary);
    border: 1px solid rgba(42, 59, 143, 0.2);
}

.btn-ghost:hover {
    background: rgba(42, 59, 143, 0.2);
}

/* Premium Form Controls */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-sm);
    font-size: 0.875rem;
    letter-spacing: 0.025em;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    background: white;
    font-family: var(--font-body);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(42, 59, 143, 0.1);
    transform: translateY(-1px);
}

.form-control:hover {
    border-color: var(--gray-300);
}

/* Premium Tab System */
.tab-container {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.tab-nav {
    display: flex;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 0.5rem;
    gap: 0.25rem;
}

.tab-button {
    flex: 1;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.tab-button.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.tab-button:hover:not(.active) {
    background: rgba(42, 59, 143, 0.05);
    color: var(--primary);
}

.tab-content {
    display: none;
    padding: var(--space-xl);
    animation: fadeInUp 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

/* Premium Cards */
.premium-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: var(--space-xl);
    transition: all var(--transition-normal);
    border: 1px solid var(--gray-100);
    position: relative;
    overflow: hidden;
}

.premium-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.premium-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.stat-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
}

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

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
    font-size: 1.25rem;
    color: white;
}

.stat-icon.blue { background: var(--gradient-primary); }
.stat-icon.green { background: var(--gradient-success); }
.stat-icon.yellow { background: linear-gradient(135deg, var(--warning), #D97706); }
.stat-icon.red { background: linear-gradient(135deg, var(--error), #DC2626); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-xs);
    font-family: var(--font-display);
}

.stat-label {
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Premium Table */
.premium-table {
    width: 100%;
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.premium-table thead {
    background: var(--gray-50);
}

.premium-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.premium-table td {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-100);
    vertical-align: middle;
}

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

.premium-table tbody tr:hover {
    background: var(--gray-50);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-draft { background: rgba(107, 114, 128, 0.1); color: var(--gray-700); }
.status-sent { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.status-viewed { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.status-paid { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.status-overdue { background: rgba(239, 68, 68, 0.1); color: var(--error); }

/* Premium Invoice Preview */
.invoice-preview {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-2xl);
    margin: var(--space-lg) 0;
    position: relative;
    overflow: hidden;
}

.invoice-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--gradient-primary);
}

/* Line Items Table */
.line-items-table {
    width: 100%;
    margin: var(--space-xl) 0;
}

.line-items-table th {
    padding: 1rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--primary);
}

.line-items-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.line-item-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.line-item-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(42, 59, 143, 0.1);
}

/* Totals Section */
.totals-section {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-top: var(--space-xl);
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.total-row:last-child {
    border-bottom: 2px solid var(--primary);
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary);
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* Loading States */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* Premium Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideInUp 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Premium Toast Notifications */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1100;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid var(--success);
}

.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

/* Responsive Design */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tab-nav {
        flex-direction: column;
    }
    
    .tab-button {
        flex: none;
    }
    
    .premium-card,
    .invoice-preview {
        padding: var(--space-lg);
    }
    
    .modal-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #1F2937;
        --gray-100: #374151;
        --gray-200: #4B5563;
        --gray-800: #F9FAFB;
        --gray-900: #FFFFFF;
    }
    
    body {
        background: linear-gradient(135deg, #1F2937 0%, #111827 100%);
        color: var(--gray-100);
    }
    
    .glass-card,
    .premium-card,
    .stat-card,
    .invoice-preview {
        background: rgba(31, 41, 55, 0.95);
        border-color: rgba(75, 85, 99, 0.2);
    }
}

/* Premium Sidebar Styles */
.invoice-app-layout {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.invoice-sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition-normal);
    overflow-y: auto;
}

.invoice-sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--gray-200);
    background: var(--gradient-primary);
    color: white;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-display);
}

.sidebar-logo i {
    font-size: 1.5rem;
}

.sidebar-nav {
    padding: var(--space-lg) 0;
}

.sidebar-section {
    margin-bottom: var(--space-xl);
}

.sidebar-section-title {
    padding: 0 var(--space-xl) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-item {
    margin: 0;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-xl);
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar-menu-link:hover {
    background: rgba(42, 59, 143, 0.05);
    color: var(--primary);
    border-left-color: var(--primary);
}

.sidebar-menu-link.active {
    background: rgba(42, 59, 143, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-menu-link.active::after {
    content: '';
    position: absolute;
    right: var(--space-lg);
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

.sidebar-menu-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-menu-text {
    flex: 1;
}

.sidebar-menu-badge {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    min-width: 20px;
    text-align: center;
}

.sidebar-menu-badge.success {
    background: var(--success);
}

.sidebar-menu-badge.warning {
    background: var(--warning);
}

.sidebar-menu-badge.error {
    background: var(--error);
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-content-with-sidebar {
    margin-left: 280px;
    flex: 1;
    transition: margin-left var(--transition-normal);
}

.main-content-with-sidebar.sidebar-collapsed {
    margin-left: 0;
}

.sidebar-toggle {
    position: fixed;
    top: var(--space-lg);
    left: var(--space-lg);
    z-index: 101;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-sm);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: none;
}

.sidebar-toggle:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.sidebar-toggle i {
    font-size: 1.25rem;
    color: var(--gray-700);
}

/* Mobile Sidebar */
@media (max-width: 1024px) {
    .invoice-sidebar {
        transform: translateX(-100%);
    }
    
    .invoice-sidebar.open {
        transform: translateX(0);
    }
    
    .main-content-with-sidebar {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-fast);
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Sidebar Animations */
.sidebar-menu-link {
    transform: translateX(0);
}

.sidebar-menu-link:hover {
    transform: translateX(4px);
}

.sidebar-menu-item {
    animation: slideInLeft 0.3s ease-out;
    animation-fill-mode: both;
}

.sidebar-menu-item:nth-child(1) { animation-delay: 0.1s; }
.sidebar-menu-item:nth-child(2) { animation-delay: 0.15s; }
.sidebar-menu-item:nth-child(3) { animation-delay: 0.2s; }
.sidebar-menu-item:nth-child(4) { animation-delay: 0.25s; }
.sidebar-menu-item:nth-child(5) { animation-delay: 0.3s; }
.sidebar-menu-item:nth-child(6) { animation-delay: 0.35s; }
.sidebar-menu-item:nth-child(7) { animation-delay: 0.4s; }
.sidebar-menu-item:nth-child(8) { animation-delay: 0.45s; }

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Print Styles */
@media print {
    .no-print { display: none !important; }
    .invoice-preview { box-shadow: none; border: 1px solid #ccc; }
    .invoice-sidebar { display: none !important; }
    .main-content-with-sidebar { margin-left: 0 !important; }
    body { background: white; }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
.btn:focus,
.form-control:focus,
.tab-button:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #000;
        border: 2px solid #000;
    }
    
    .form-control {
        border-width: 2px;
    }
}
