/* Florial-inspired Invoice System Styles */

:root {
    --primary: #e8a4b8;
    --primary-dark: #d4899e;
    --primary-light: #f5d5de;
    --secondary: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --bg-cream: #fefcfb;
    --bg-light: #fff9f8;
    --bg-white: #ffffff;
    
    --text-dark: #1f2937;
    --text-gray: #6b7280;
    --text-light: #9ca3af;
    
    --border-color: #f3e8eb;
    --border-dark: #e5d6da;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 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);
    
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --font-sans: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, var(--bg-cream) 0%, var(--bg-light) 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; color: var(--text-dark); }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.25rem; } h4 { font-size: 1.125rem; }

a { color: var(--primary-dark); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary); }

.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: var(--shadow);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-white) 100%);
}

.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; }
.sidebar-logo svg { width: 40px; height: 40px; color: var(--primary); }
.sidebar-logo span { font-size: 1.25rem; font-weight: 700; color: var(--text-dark); }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-section { margin-bottom: 1.5rem; }
.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    padding: 0.5rem 1.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-gray);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover { background: var(--bg-light); color: var(--primary-dark); }
.nav-link.active { background: var(--primary-light); color: var(--primary-dark); border-left-color: var(--primary); }
.nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); background: var(--bg-light); }
.user-info { display: flex; align-items: center; gap: 0.75rem; }
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    font-weight: 600;
}
.user-details { flex: 1; }
.user-name { font-weight: 600; font-size: 0.9rem; color: var(--text-dark); }
.user-email { font-size: 0.75rem; color: var(--text-light); }

/* Main Content */
.main-content { flex: 1; margin-left: 280px; min-height: 100vh; }

.content-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.content-header h1 { display: flex; align-items: center; gap: 0.75rem; }
.content-header h1 svg { color: var(--primary); }
.header-actions { display: flex; gap: 0.75rem; }
.content-body { padding: 2rem; }

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-white) 100%);
}

.card-header h2, .card-header h3 { display: flex; align-items: center; gap: 0.5rem; }
.card-header svg { color: var(--primary); }
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); background: var(--bg-light); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.stat-card .stat-icon.primary { background: var(--primary-light); color: var(--primary-dark); }
.stat-card .stat-icon.success { background: #d1fae5; color: var(--success); }
.stat-card .stat-icon.info { background: #dbeafe; color: var(--info); }
.stat-card .stat-icon.warning { background: #fef3c7; color: var(--warning); }

.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--text-dark); line-height: 1; margin-bottom: 0.25rem; }
.stat-card .stat-label { font-size: 0.875rem; color: var(--text-gray); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(232, 164, 184, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #c47a8f 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(232, 164, 184, 0.4);
}

.btn-secondary { background: var(--bg-white); color: var(--text-gray); border-color: var(--border-dark); }
.btn-secondary:hover { background: var(--bg-light); color: var(--text-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary-dark); }
.btn-outline:hover { background: var(--primary-light); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }
.btn-icon { padding: 0.5rem; }
.btn-group { display: flex; gap: 0.5rem; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--text-dark); margin-bottom: 0.5rem; }
.form-label.required::after { content: ' *'; color: var(--danger); }

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    background: var(--bg-white);
    color: var(--text-dark);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232, 164, 184, 0.2); }
.form-control::placeholder { color: var(--text-light); }
.form-control.is-invalid { border-color: var(--danger); }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { cursor: pointer; }

.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check-input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.form-check-label { font-size: 0.9rem; cursor: pointer; }
.form-hint { font-size: 0.75rem; color: var(--text-light); margin-top: 0.25rem; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.25rem; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }

/* Tables */
.table-wrapper { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 0.875rem 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.table th { font-weight: 600; color: var(--text-gray); background: var(--bg-light); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.table tbody tr { transition: background-color 0.15s; }
.table tbody tr:hover { background: var(--bg-light); }
.table td.actions { white-space: nowrap; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.625rem; font-size: 0.75rem; font-weight: 500; border-radius: 9999px; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #d1fae5; color: #059669; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-secondary { background: #f3f4f6; color: #6b7280; }
.badge-info { background: #dbeafe; color: #2563eb; }

/* Alerts */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; display: flex; align-items: flex-start; gap: 0.75rem; }
.alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 0.125rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.25rem; margin-top: 1.5rem; }
.pagination a, .pagination span { display: flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 0.5rem; font-size: 0.875rem; border-radius: var(--radius); color: var(--text-gray); transition: all 0.2s; }
.pagination a:hover { background: var(--primary-light); color: var(--primary-dark); }
.pagination .active span { background: var(--primary); color: white; }
.pagination .disabled span { color: var(--text-light); cursor: not-allowed; }

/* Empty State */
.empty-state { text-align: center; padding: 3rem 2rem; color: var(--text-gray); }
.empty-state svg { width: 64px; height: 64px; color: var(--primary-light); margin-bottom: 1rem; }
.empty-state h3 { margin-bottom: 0.5rem; color: var(--text-dark); }
.empty-state p { margin-bottom: 1.5rem; }

/* Invoice Items */
.invoice-items { border: 1px solid var(--border-color); border-radius: var(--radius); overflow: hidden; }
.invoice-item { display: grid; grid-template-columns: 3fr 70px 60px 100px 100px 36px; gap: 0.5rem; padding: 0.75rem 1rem; align-items: center; border-bottom: 1px solid var(--border-color); background: var(--bg-white); }
.invoice-item:last-child { border-bottom: none; }
.invoice-item-header { background: var(--bg-light); font-weight: 600; font-size: 0.7rem; color: var(--text-gray); text-transform: uppercase; letter-spacing: 0.05em; }
.invoice-item input { width: 100%; }
.invoice-item .remove-item { color: var(--danger); cursor: pointer; opacity: 0.6; transition: opacity 0.2s; background: none; border: none; padding: 0.25rem; }
.invoice-item .remove-item:hover { opacity: 1; }

.invoice-totals { background: var(--bg-light); padding: 1rem; text-align: right; }
.invoice-totals .total-row { display: flex; justify-content: flex-end; gap: 2rem; padding: 0.25rem 0; }
.invoice-totals .total-label { color: var(--text-gray); min-width: 120px; }
.invoice-totals .total-value { font-weight: 600; min-width: 100px; }
.invoice-totals .grand-total { font-size: 1.25rem; color: var(--primary-dark); border-top: 2px solid var(--border-dark); padding-top: 0.5rem; margin-top: 0.5rem; }

/* File Upload */
.file-upload { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px dashed var(--border-dark); border-radius: var(--radius-lg); padding: 2rem; text-align: center; cursor: pointer; transition: all 0.2s; background: var(--bg-light); min-height: 200px; }
.file-upload:hover { border-color: var(--primary); background: var(--primary-light); }
.file-upload.dragover { border-color: var(--primary); background: var(--primary-light); }
.file-upload svg { width: 48px; height: 48px; color: var(--primary); margin-bottom: 1rem; display: block; }
.file-upload input[type="file"] { display: none; }

/* Modal */
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.2s; }
.modal-backdrop.active { opacity: 1; visibility: visible; }
.modal { background: var(--bg-white); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); max-width: 500px; width: 90%; max-height: 90vh; overflow: hidden; transform: scale(0.9); transition: transform 0.2s; }
.modal-backdrop.active .modal { transform: scale(1); }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-light); padding: 0.25rem; }
.modal-close:hover { color: var(--text-dark); }
.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 0.75rem; background: var(--bg-light); }

/* Invoice Preview */
.invoice-preview { background: white; max-width: 800px; margin: 0 auto; padding: 2rem; box-shadow: var(--shadow-lg); border-radius: var(--radius-lg); }
.invoice-header-section { display: flex; justify-content: space-between; margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 2px solid var(--primary); }
.invoice-title { font-size: 1.75rem; color: var(--primary-dark); margin-bottom: 0.5rem; }
.invoice-number { font-size: 1.125rem; color: var(--text-gray); }
.invoice-meta { text-align: right; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.party-box h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-light); margin-bottom: 0.5rem; }
.party-box p { white-space: pre-line; line-height: 1.6; }

/* Login Page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--bg-cream) 0%, var(--primary-light) 100%); padding: 2rem; }
.login-card { background: var(--bg-white); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; overflow: hidden; }
.login-header { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); padding: 2rem; text-align: center; color: white; }
.login-header svg { width: 64px; height: 64px; margin-bottom: 1rem; }
.login-header h1 { color: white; font-size: 1.5rem; margin-bottom: 0.25rem; }
.login-header p { opacity: 0.9; font-size: 0.9rem; }
.login-body { padding: 2rem; }
.login-footer { padding: 1rem 2rem 2rem; text-align: center; color: var(--text-light); font-size: 0.8rem; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .form-row { grid-template-columns: 1fr; }
    .invoice-item { grid-template-columns: 1fr; gap: 0.5rem; }
}

@media (max-width: 768px) {
    .content-header { flex-direction: column; gap: 1rem; align-items: stretch; }
    .header-actions { justify-content: flex-end; }
    .stats-grid { grid-template-columns: 1fr; }
    .invoice-parties { grid-template-columns: 1fr; }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-gray); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary-dark); }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 1rem; } .mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 1rem; } .mb-4 { margin-bottom: 1.5rem; }
.d-flex { display: flex; } .align-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; } .gap-2 { gap: 0.5rem; } .gap-3 { gap: 1rem; }
.w-full { width: 100%; } .hidden { display: none; }

/* Floral decoration */
.floral-bg { position: fixed; top: 0; right: 0; width: 400px; height: 400px; opacity: 0.03; pointer-events: none; z-index: 0; }

/* Spinner animation */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

