/* ============================================
   assets/css/admin.css - Central Stylesheet
   ============================================ */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    --primary: #0f5e9c;
    --primary-light: #5abcd8;
    --primary-lighter: #74ccf4;
    --background: #f9f6f4;
    --white: #ffffff;
    --text-dark: #1a2a3a;
    --text-muted: #6b7a8a;
    --shadow: 0 2px 12px rgba(15, 94, 156, 0.12);
    --shadow-hover: 0 4px 24px rgba(15, 94, 156, 0.18);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
    --sidebar-width: 260px;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f5e9c 0%, #0a4a7a 100%);
    color: var(--white);
    transition: transform 0.3s ease;
    z-index: 1050;
    overflow-y: auto;
    box-shadow: 2px 0 20px rgba(15, 94, 156, 0.3);
}

.sidebar-brand {
    padding: 1.8rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand img {
    max-height: 60px;
    margin-bottom: 0.5rem;
}

.sidebar-brand h3 {
    font-size: 1.1rem;
    margin: 0;
    color: var(--white);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    padding: 1rem 0 2rem;
}

.sidebar-nav .nav-section {
    padding: 0.8rem 1.5rem 0.4rem;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
}

.sidebar-nav .nav-item {
    padding: 0.6rem 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
    margin: 2px 0;
}

.sidebar-nav .nav-item:hover {
    background: rgba(90, 188, 216, 0.15);
    border-left-color: var(--primary-light);
}

.sidebar-nav .nav-item.active {
    background: rgba(90, 188, 216, 0.2);
    border-left-color: var(--primary-light);
}

.sidebar-nav .nav-item a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    font-weight: 400;
    transition: var(--transition);
}

.sidebar-nav .nav-item:hover a,
.sidebar-nav .nav-item.active a {
    color: var(--white);
}

.sidebar-nav .nav-item a i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
    color: var(--primary-light);
    transition: var(--transition);
}

.sidebar-nav .nav-item:hover a i,
.sidebar-nav .nav-item.active a i {
    color: var(--primary-lighter);
}

/* ============================================
   SIDEBAR OVERLAY (Mobile)
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: var(--white);
    padding: 1rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(90, 188, 216, 0.15);
}

.header-title h4 {
    margin: 0;
    color: var(--primary);
    font-weight: 600;
    font-size: 1.3rem;
}

.header-title small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-actions .user-info {
    color: var(--text-dark);
    font-size: 0.9rem;
}

.header-actions .user-info i {
    color: var(--primary-light);
    margin-right: 6px;
}

/* ============================================
   MOBILE TOGGLE BUTTON
   ============================================ */
.mobile-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1060;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    border: none;
    box-shadow: 0 4px 20px rgba(15, 94, 156, 0.3);
    font-size: 1.5rem;
    transition: var(--transition);
    cursor: pointer;
}

.mobile-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(15, 94, 156, 0.4);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    padding: 0.35rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 20px;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-primary {
    background: rgba(90, 188, 216, 0.2);
    color: var(--primary);
}

.badge-primary-custom {
    background: rgba(90, 188, 216, 0.2);
    color: var(--primary);
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: none;
    color: var(--white);
    transition: var(--transition);
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(15, 94, 156, 0.3);
    color: var(--white);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(90, 188, 216, 0.1);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(90, 188, 216, 0.12);
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--primary);
    font-size: 1rem;
}

.card-body {
    padding: 1.5rem;
}

/* ============================================
   TABLES
   ============================================ */
.table {
    margin-bottom: 0;
}

.table thead th {
    border-top: none;
    border-bottom: 2px solid rgba(90, 188, 216, 0.15);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.8rem 1rem;
}

.table tbody td {
    padding: 0.8rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(90, 188, 216, 0.08);
}

.table tbody tr:hover {
    background: rgba(90, 188, 216, 0.04);
}

/* ============================================
   FORMS
   ============================================ */
.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border: 2px solid rgba(90, 188, 216, 0.15);
    padding: 0.6rem 1rem;
    transition: var(--transition);
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(90, 188, 216, 0.15);
}

.form-label {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.9rem;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    padding: 1rem 1.5rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* ============================================
   STOCK PAGE SPECIFIC
   ============================================ */
.stock-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stock-stat-card {
    background: var(--white);
    border-radius: 10px;
    padding: 15px 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(90, 188, 216, 0.1);
    text-align: center;
}

.stock-stat-card .stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.stock-stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.stock-stat-card .stat-icon {
    font-size: 1.5rem;
    color: var(--primary-light);
    margin-bottom: 5px;
}

.stock-stat-card.warning .stat-number {
    color: #f39c12;
}

.stock-stat-card.danger .stat-number {
    color: #e74c3c;
}

.stock-stat-card.success .stat-number {
    color: #27ae60;
}

.filter-bar {
    background: var(--white);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid rgba(90, 188, 216, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-bar .form-control,
.filter-bar .form-select {
    min-width: 150px;
}

.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.quick-actions .btn {
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.stock-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.stock-badge.good {
    background: #d4edda;
    color: #155724;
}

.stock-badge.low {
    background: #fff3cd;
    color: #856404;
}

.stock-badge.critical {
    background: #f8d7da;
    color: #721c24;
}

.stock-badge.out-of-stock {
    background: #f5c6cb;
    color: #721c24;
}

.progress-stock {
    height: 6px;
    border-radius: 3px;
    background: #ecf0f1;
    overflow: hidden;
    width: 100px;
    display: inline-block;
    vertical-align: middle;
}

.progress-stock .progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-stock .progress-bar.good {
    background: #27ae60;
}

.progress-stock .progress-bar.low {
    background: #f39c12;
}

.progress-stock .progress-bar.critical {
    background: #e74c3c;
}

.product-image-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--background);
    border: 1px solid rgba(90, 188, 216, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .mobile-toggle {
        display: block;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
    }

    .header-actions {
        justify-content: center;
    }

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

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

    .filter-bar .form-control,
    .filter-bar .form-select {
        min-width: 100%;
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .stock-stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stock-stat-card .stat-number {
        font-size: 1.3rem;
    }
}

@media (min-width: 993px) {
    .sidebar {
        transform: translateX(0) !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-primary-custom {
    color: var(--primary) !important;
}

.bg-primary-custom {
    background: var(--primary) !important;
}

/* Stock badges - Additional styles */
.stock-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.stock-badge.good {
    background: #d4edda;
    color: #155724;
}

.stock-badge.low {
    background: #fff3cd;
    color: #856404;
}

.stock-badge.critical {
    background: #f8d7da;
    color: #721c24;
}

.stock-badge.out-of-stock {
    background: #f5c6cb;
    color: #721c24;
}

.stock-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.stock-badge.paid {
    background: #d4edda;
    color: #155724;
}

.stock-badge.partial {
    background: #cce5ff;
    color: #004085;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Product image thumb */
.product-image-thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--background);
    border: 1px solid rgba(90, 188, 216, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image-thumb i {
    font-size: 1.5rem;
    color: #6b7a8a;
}

/* List group for settings */
.list-group-item {
    border: none;
    padding: 12px 20px;
    border-radius: 8px !important;
    margin-bottom: 4px;
    transition: var(--transition);
}

.list-group-item:hover {
    background: rgba(90, 188, 216, 0.08);
}

.list-group-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: none;
    color: var(--white);
}

.list-group-item i {
    width: 20px;
    margin-right: 10px;
}