/* ============================================
   PROFESSIONAL BUSINESS UI - CLEAN & MINIMAL
   ============================================ */
:root {
    /* Professional Color Palette */
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --accent: #0891b2;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    /* Clean Neutrals */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --border-color: #e2e8f0;
    --border-dark: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* 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);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition: 0.2s ease;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

.sidebar {
    width: 260px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    padding: var(--spacing-lg) 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: var(--spacing-lg);
    max-width: calc(100vw - 260px);
}

/* ============================================
   SIDEBAR
   ============================================ */
.logo {
    padding: 0 var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.logo p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.logo-img {
    max-width: 150px;
    height: auto;
    margin-bottom: 0.5rem;
    display: block;
}

.login-logo-img {
    width: 120px;
    height: auto;
    margin-bottom: 1rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0.75rem var(--spacing-lg);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    font-size: 0.9375rem;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: #eff6ff;
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-item .icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.page-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.date-display {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ============================================
   CARDS & STATS
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: all var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-dark);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

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

.stat-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.stat-content h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.875rem;
}

.btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

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

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

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

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-dark);
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #dc2626;
}

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

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

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    transition: all var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-tertiary);
}

th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-secondary);
}

tfoot {
    background: var(--bg-tertiary);
    font-weight: 600;
}

tfoot td {
    border-top: 2px solid var(--border-dark);
    border-bottom: none;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.card h3 {
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-cash {
    background: #d1fae5;
    color: #065f46;
}

.badge-credit {
    background: #fee2e2;
    color: #991b1b;
}

.badge-low-stock {
    background: #fef3c7;
    color: #92400e;
}

.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.close-modal:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ============================================
   UTILITIES
   ============================================ */
.loading {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

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

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-primary {
    color: var(--primary);
}

.text-muted {
    color: var(--text-muted);
}

.mt-1 {
    margin-top: var(--spacing-sm);
}

.mt-2 {
    margin-top: var(--spacing-md);
}

.mb-1 {
    margin-bottom: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

/* ============================================
   ALERT/NOTIFICATION
   ============================================ */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    border: 1px solid;
}

.alert-success {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.alert-danger {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

/* ============================================
   INVOICE SPECIFIC
   ============================================ */
.invoice-container {
    background: white;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-dark);
}

.invoice-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.invoice-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.invoice-table {
    margin: 2rem 0;
}

.invoice-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-dark);
}

@media print {

    .sidebar,
    .page-header,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        max-width: 100%;
    }

    .invoice-container {
        border: none;
        box-shadow: none;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }

    .app-container {
        flex-direction: column;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   PASSWORD TOGGLE
   ============================================ */
.password-toggle-wrapper {
    position: relative;
}

.password-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1;
}

.password-input {
    padding-right: 40px;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}