/* assets/css/style.css */
:root {
    /* Dark Theme Palette */
    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: #334155;

    /* Spacing & Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 15px var(--primary-glow);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    background-color: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    transition: all var(--transition-normal);
}

.brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.5);
    padding: 0.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: white;
    background-color: var(--primary);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    font-weight: 800;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    box-sizing: border-box;
    transition: all var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background-color: rgba(15, 23, 42, 0.8);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--border);
    color: white;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background-color: var(--bg-surface-hover);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    transition: background-color var(--transition-fast);
}

tr {
    transition: background-color var(--transition-fast);
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

tr:last-child td {
    border-bottom: none;
}

/* Utilities */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.flex {
    display: flex;
}

.gap-4 {
    gap: 1rem;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .app-header {
        padding: 0 1rem;
        height: auto;
        flex-wrap: wrap;
        padding-bottom: 1rem;
    }

    .nav-links {
        overflow-x: auto;
        width: 100%;
        padding-bottom: 0.5rem;
        margin-top: 0.5rem;
    }

    .main-content {
        padding: 1rem;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    width: min(900px, 95vw);
    margin: 0 auto;
    border: 1px solid var(--border);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
@media (max-width: 640px) {
  .modal-content { padding: 1rem; }
}

/* Action Icons */
.action-icon {
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.action-icon:hover {
    background: var(--bg-surface-hover);
    color: var(--primary);
    transform: scale(1.1);
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    text-align: center;
    border-radius: 6px;
    padding: 6px 0;
    position: absolute;
    z-index: 20;
    bottom: 130%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    pointer-events: none;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary);
}

/* Dashboard Metrics */
.metric-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.metric-info {
    flex: 1;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 0.5rem 0;
    font-weight: 500;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Utility Colors */
.bg-blue-light {
    background-color: rgba(59, 130, 246, 0.1);
}

.text-blue {
    color: #3b82f6;
}

.bg-green-light {
    background-color: rgba(16, 185, 129, 0.1);
}

.text-green {
    color: #10b981;
}

.bg-red-light {
    background-color: rgba(239, 68, 68, 0.1);
}

.text-red {
    color: #ef4444;
}

.bg-orange-light {
    background-color: rgba(245, 158, 11, 0.1);
}

.text-orange {
    color: #f59e0b;
}

.text-white {
    color: white;
}

.bg-danger-dark {
    background-color: #450a0a;
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

/* Transaction Modal Styles */
.modal-split-view {
    display: flex;
    gap: 2rem;
    height: 400px;
}

.customer-list-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.customer-list-header {
    padding: 0.75rem;
    background: var(--bg-surface-hover);
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.customer-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.customer-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
}

.customer-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.customer-item.selected {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.customer-item:last-child {
    border-bottom: none;
}

.transaction-form-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Customer chooser (transactions) */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-backdrop.show {
    display: flex;
}

.modal-panel {
    background: var(--bg-surface);
    padding: 1rem 1rem 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 820px;
    box-shadow: var(--shadow-lg);
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.modal-actions { display: flex; justify-content: flex-end; padding: .75rem 0 1rem 0; }

.chooser-item { padding: 10px 12px; border-radius: 10px; transition: all var(--transition-normal); }
.chooser-item:hover { background: rgba(255, 255, 255, 0.06); }
.chooser-item.selected { background: rgba(59, 130, 246, 0.18); border: 1px solid rgba(59, 130, 246, 0.5); color: #fff; }
.chooser-col.disabled { opacity: 0.5; pointer-events: none; }
.chooser-toggle { display: inline-block; font-size: 0.95rem; margin-left: 6px; opacity: 0.6; cursor: pointer; }
.chooser-toggle.active { color: var(--primary); opacity: 1; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
}
