/* ===================================================================
   Adyaf Gulf IT Asset Management System - Stylesheet
   Modern design with cards, charts, and professional UI
   =================================================================== */

:root {
    --navy: #1f3864;
    --navy-dark: #16294a;
    --purple: #7b2f8e;
    --purple-light: #9b4fb0;
    --bg-light: #f5f7fb;
    --bg-white: #ffffff;
    --border: #dfe3e8;
    --text: #2c3542;
    --text-light: #6b7280;
    
    /* Status colors */
    --status-in-use: #10b981;
    --status-in-stock: #3b82f6;
    --status-repair: #f59e0b;
    --status-lost: #ef4444;
    --status-disposed: #eab308;
    
    /* Other colors */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-light);
    color: var(--text);
    line-height: 1.5;
}

/* ===== TOPBAR ===== */
.topbar {
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    height: 40px;
    background: #fff;
    padding: 4px;
    border-radius: 6px;
}

.app-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-chip {
    background: rgba(255,255,255,0.12);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-chip small {
    opacity: 0.85;
    font-size: 12px;
}

/* ===== NAVIGATION ===== */
.mainnav {
    background: var(--purple);
    padding: 0 24px;
    display: flex;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mainnav a {
    color: #fff;
    text-decoration: none;
    display: inline-block;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.mainnav a:hover {
    background: rgba(255,255,255,0.1);
    border-bottom-color: #fff;
}

.mainnav a.active {
    border-bottom-color: #fff;
    background: rgba(255,255,255,0.05);
}

/* ===== MAIN CONTAINER ===== */
.container {
    max-width: 1400px;
    margin: 24px auto;
    padding: 0 20px;
}

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

.page-header h1 {
    margin: 0;
    color: var(--navy);
    font-size: 28px;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card h2, .card h3 {
    color: var(--navy);
    margin-top: 0;
}

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

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-card .stat-icon {
    font-size: 28px;
    margin-bottom: 8px;
    opacity: 0.7;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--navy);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== CHARTS ===== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.chart-card h3 {
    margin-top: 0;
    color: var(--navy);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--navy);
    color: #fff;
}

.btn-primary:hover {
    background: var(--navy-dark);
    box-shadow: 0 2px 8px rgba(31, 56, 100, 0.2);
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-purple {
    background: var(--purple);
    color: #fff;
}

.btn-purple:hover {
    background: var(--purple-light);
}

.btn-outline {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
}

.btn-outline:hover {
    background: rgba(255,255,255,0.1);
}

.btn-danger {
    background: var(--error);
    color: #fff;
}

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

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

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 10px 20px;
    font-size: 14px;
}

/* ===== TABLE ===== */
.table-wrap {
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    font-size: 13px;
}

thead {
    background: var(--navy);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid #1a2847;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

tbody tr {
    transition: background 0.15s;
}

tbody tr:hover {
    background: #f9fafb;
}

tbody tr:nth-child(even) {
    background: #fafbfc;
}

tbody tr:nth-child(even):hover {
    background: #f0f3f8;
}

/* ===== BADGES & STATUS ===== */
.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    display: inline-block;
}

.badge-in-use {
    background: var(--status-in-use);
}

.badge-in-stock {
    background: var(--status-in-stock);
}

.badge-repair {
    background: var(--status-repair);
}

.badge-lost {
    background: var(--status-lost);
}

.badge-disposed {
    background: var(--status-disposed);
}

/* ===== FILTERS ===== */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--navy);
}

.filter-field input,
.filter-field select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

.filter-field input:focus,
.filter-field select:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(31, 56, 100, 0.1);
}

/* ===== FORMS ===== */
form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--navy);
}

form input,
form select,
form textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 14px;
    transition: border-color 0.2s;
}

form input:focus,
form select:focus,
form textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(31, 56, 100, 0.1);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0 16px;
}

.form-group {
    margin-bottom: 14px;
}

/* ===== TOOLBAR ===== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.toolbar-left {
    flex: 1;
}

.toolbar-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #7f1d1d;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ===== LOGIN PAGE ===== */
.login-wrap {
    max-width: 400px;
    margin: 80px auto;
    background: var(--bg-white);
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.login-wrap img {
    height: 60px;
    margin-bottom: 16px;
}

.login-wrap h2 {
    color: var(--navy);
    margin-bottom: 20px;
    font-size: 20px;
}

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

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-white);
    padding: 24px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

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

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

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a, .pagination span {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    text-decoration: none;
    color: var(--text);
}

.pagination a:hover {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

.pagination .active {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

/* ===== PRINT ===== */
@media print {
    .topbar, .mainnav, .toolbar, .filter-bar, .no-print, .footer, button, .btn {
        display: none !important;
    }
    body {
        background: #fff;
    }
    .card {
        border: none;
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-right {
        justify-content: stretch;
    }

    .toolbar-right .btn {
        flex: 1;
        text-align: center;
    }
}
