/**
 * Bank Guarantee Management System
 * Modern Responsive CSS with Light/Dark Theme Support
 */

/* =====================================================
   CSS VARIABLES - THEME COLORS
   ===================================================== */

:root {
    /* Light Theme Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);

    /* Brand Colors */
    --primary: #0066cc;
    --primary-hover: #0052a3;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --secondary: #6c757d;

    /* Status Colors */
    --status-safe: #28a745;
    --status-attention: #17a2b8;
    --status-urgent: #ffc107;
    --status-critical: #dc3545;

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --bg-primary: #1a1d23;
    --bg-secondary: #23272e;
    --bg-tertiary: #2c3139;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --text-muted: #6c757d;
    --border-color: #3a3f47;
    --shadow: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}

/* =====================================================
   RESET & BASE STYLES
   ===================================================== */

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

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

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* =====================================================
   LAYOUT
   ===================================================== */

.main-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-title {
    opacity: 0;
    display: none;
}

.sidebar.collapsed .sidebar-menu span {
    opacity: 0;
    display: none;
}

.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .sidebar-menu i {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-footer-text {
    opacity: 0;
    display: none;
}

.sidebar.collapsed .sidebar-footer-icon {
    display: flex !important;
    justify-content: center;
}

.sidebar.collapsed .sidebar-footer > div {
    padding: 15px 10px;
    text-align: center;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    transition: all 0.3s ease;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: var(--bg-secondary);
    color: var(--primary);
}

.sidebar-menu i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
}

.main-content.expanded {
    margin-left: 70px;
}

.topbar {
    height: var(--topbar-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 999;
}

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

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

.content-wrapper {
    padding: 30px;
}

/* Theme Toggle */
.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
}

.theme-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-icon.active {
    background: var(--primary);
    color: white;
}

/* =====================================================
   COMPONENTS
   ===================================================== */

/* Cards */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    transition: var(--transition);
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 16px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-card h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
}

.stat-card.danger {
    border-left: 4px solid var(--danger);
}

.stat-card.warning {
    border-left: 4px solid var(--warning);
}

.stat-card.info {
    border-left: 4px solid var(--info);
}

.stat-card.success {
    border-left: 4px solid var(--success);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
}

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

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

.badge.bg-warning {
    background: var(--warning);
    color: #212529;
}

.badge.bg-info {
    background: var(--info);
    color: white;
}

.badge.bg-secondary {
    background: var(--secondary);
    color: white;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

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

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

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

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

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

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

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
}

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

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

select.form-control {
    cursor: pointer;
}

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

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

.table thead {
    background: var(--bg-secondary);
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-primary);
}

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

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.alert-success {
    background: rgba(40,167,69,0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-danger {
    background: rgba(220,53,69,0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: rgba(255,193,7,0.1);
    border: 1px solid var(--warning);
    color: #856404;
}

.alert-info {
    background: rgba(23,162,184,0.1);
    border: 1px solid var(--info);
    color: var(--info);
}

/* =====================================================
   UTILITIES
   ===================================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 16px; }

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }

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

    .sidebar.collapsed {
        width: var(--sidebar-width) !important;
    }

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

    .main-content.expanded {
        margin-left: 0 !important;
    }

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

    .content-wrapper {
        padding: 20px 15px;
    }

    .topbar {
        padding: 0 15px;
    }
}

/* =====================================================
   AUTH PAGES
   ===================================================== */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
}

.auth-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-card h2 {
    margin-bottom: 24px;
    text-align: center;
    color: var(--text-primary);
}

.auth-card .btn {
    width: 100%;
}
