/* =============================================
   ACO Accounting System - Styles
   ============================================= */

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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --sidebar-bg: #1e293b;
    --sidebar-text: #e2e8f0;
}

body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Screens */
.screen { display: none; }
.screen.active { display: flex; }

/* ============ LOGIN ============ */
#loginScreen {
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.login-container {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    margin: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    font-size: 42px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 5px;
}

.login-container h2 {
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 18px;
}

.form-group {
    margin-bottom: 16px;
    text-align: right;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-light);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border 0.2s;
    font-family: inherit;
}

.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(37,99,235,0.1);
}

.error-msg {
    color: var(--danger);
    margin-top: 12px;
    font-size: 14px;
}

/* ============ BUTTONS ============ */
.btn {
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; padding: 12px; font-size: 16px; }

.btn-group { display: flex; gap: 8px; }

/* ============ SIDEBAR ============ */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
    font-size: 28px;
    font-weight: bold;
    color: #60a5fa;
}

.sidebar-header .version {
    font-size: 12px;
    color: #64748b;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-item:hover { background: rgba(255,255,255,0.05); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .icon { font-size: 18px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    margin-right: 240px;
    padding: 24px;
    min-height: 100vh;
}

.page { display: none; }
.page.active { display: block; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    color: var(--text);
}

/* ============ STATS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
}

.stat-card.warning { border-color: var(--warning); background: #fffbeb; }
.stat-icon { font-size: 32px; }
.stat-value { font-size: 28px; font-weight: bold; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-light); }

/* ============ CARDS ============ */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 { font-size: 16px; }
.card-body { padding: 20px; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

/* ============ TABLES ============ */
.table-container { overflow-x: auto; }

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

.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-light);
    font-size: 13px;
}

.data-table tr:hover { background: #f8fafc; }

.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 30px;
}

.search-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

/* ============ GRID ============ */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.warehouse-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 20px;
    transition: all 0.2s;
}

.warehouse-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.warehouse-card h3 { margin-bottom: 8px; }
.warehouse-card .location { color: var(--text-light); font-size: 13px; margin-bottom: 12px; }
.warehouse-card .stats { display: flex; gap: 20px; margin-top: 12px; }
.warehouse-card .stats span { font-size: 13px; color: var(--text-light); }
.warehouse-card .stats strong { display: block; font-size: 20px; color: var(--text); }

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

.modal.active { display: flex; }

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body { padding: 20px; }

.hint {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
}

code {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .version, .sidebar-footer .user-info span, .nav-item span:not(.icon) { display: none; }
    .sidebar-header .logo { font-size: 18px; }
    .nav-item { justify-content: center; padding: 14px; }
    .main-content { margin-right: 60px; }
    .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
