/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #38bdf8;
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.6;
}

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

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

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.app-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--gray-500);
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: var(--gray-100);
    color: var(--gray-900);
}

.nav-item.active {
    background-color: #e0f2fe;
    color: var(--primary);
}

.nav-item i {
    margin-right: 0.75rem;
    width: 1.25rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    background-color: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
}

.user-details {
    margin-left: 0.75rem;
}

.user-name {
    font-weight: 500;
    color: var(--gray-900);
}

.user-email {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.logout-btn {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: var(--gray-500);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background-color: var(--gray-100);
    color: var(--gray-900);
}

.logout-btn i {
    margin-right: 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
}

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: var(--white);
    border-bottom: 1px solid var(--gray-200);
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--gray-500);
}

.mobile-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.mobile-spacer {
    width: 2rem;
}

.content-wrapper {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Login Page */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--gray-100);
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background-color: var(--white);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-circle {
    width: 3rem;
    height: 3rem;
    background-color: var(--primary);
    color: var(--white);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--gray-500);
}

.login-form {
    margin-bottom: 1.5rem;
}

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

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

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: bold;
}

.page-header p {
    color: var(--gray-500);
}

/* Cards */
.card {
    background-color: var(--white);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

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

.stat-card {
    background-color: var(--white);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: flex;
    align-items: center;
}

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

.stat-icon-blue { background-color: var(--primary); }
.stat-icon-green { background-color: var(--success); }
.stat-icon-yellow { background-color: var(--warning); }
.stat-icon-red { background-color: var(--danger); }

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: bold;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 0.875rem;
}

.btn i {
    margin-right: 0.5rem;
}

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

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

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-900);
}

.btn-secondary:hover {
    background-color: var(--gray-300);
}

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

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

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background-color: var(--gray-100);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.flex-2 {
    flex: 2;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--gray-200);
}

.form-section:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--gray-700);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background-color: var(--gray-100);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--gray-500);
}

.table tbody tr:hover {
    background-color: var(--gray-100);
}

.invoice-number {
    font-weight: 500;
}

.invoice-uuid {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.status-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.text-green { color: var(--success); }
.text-yellow { color: var(--warning); }
.text-red { color: var(--danger); }
.text-gray { color: var(--gray-500); }

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success { background-color: #dcfce7; color: #166534; }
.badge-warning { background-color: #fef9c3; color: #854d0e; }
.badge-danger { background-color: #fee2e2; color: #991b1b; }
.badge-gray { background-color: var(--gray-200); color: var(--gray-700); }
.badge-info { background-color: #dbeafe; color: #1e40af; }

/* Action List */
.action-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--gray-700);
    transition: all 0.2s;
}

.action-item:hover {
    background-color: var(--gray-100);
}

.action-item-primary {
    background-color: #e0f2fe;
    color: var(--primary);
}

.action-item-primary:hover {
    background-color: #bae6fd;
}

.action-item i:first-child {
    margin-right: 0.75rem;
}

/* Status List */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-success { background-color: #dcfce7; color: #166534; }
.status-info { background-color: #dbeafe; color: #1e40af; }
.status-warning { background-color: #fef9c3; color: #854d0e; }

/* Alert */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Invoice Form */
.item-row {
    background-color: var(--gray-100);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.totals-summary {
    background-color: var(--gray-100);
    padding: 1.5rem;
    border-radius: 0.5rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

.total-row-main {
    font-size: 1.125rem;
    font-weight: bold;
    border-top: 1px solid var(--gray-300);
    margin-top: 0.5rem;
    padding-top: 1rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-header {
        display: flex;
    }

    .form-row {
        flex-direction: column;
        gap: 0.5rem;
    }

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

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