/* ============================================================
   Smart Guardian - Admin Panel CSS
   ============================================================ */

/* ========== CUSTOM SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.admin-sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* ========== ADMIN LAYOUT ========== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    background: #f0f2f5;
}

.admin-sidebar {
    width: 260px;
    background: #1a1a2e;
    color: rgba(255,255,255,0.8);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: all 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

.admin-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-sidebar-header .logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #FF6600, #e55a00);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
}

.admin-sidebar-header h2 {
    font-size: 16px;
    color: #fff;
    font-weight: 700;
}

.admin-sidebar-header h2 span { color: #FF6600; }

.admin-sidebar-header small {
    display: block;
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Sidebar Menu */
.admin-menu { padding: 15px 0; }

.admin-menu-label {
    padding: 8px 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.3);
    font-weight: 600;
}

.admin-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.admin-menu a:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
    border-left-color: rgba(255,102,0,0.5);
}

.admin-menu a.active {
    color: #fff;
    background: rgba(255,102,0,0.1);
    border-left-color: #FF6600;
}

.admin-menu a i {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.admin-menu a .menu-badge {
    margin-left: auto;
    background: #FF6600;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.admin-topbar {
    background: #fff;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-topbar h1 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

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

.admin-topbar-right a {
    color: #666;
    font-size: 14px;
    transition: color 0.2s;
}

.admin-topbar-right a:hover { color: #FF6600; }

.admin-content {
    padding: 30px;
}

/* ========== STAT CARDS ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-card-icon.blue { background: rgba(59,130,246,0.1); color: #3b82f6; }
.stat-card-icon.green { background: rgba(34,197,94,0.1); color: #22c55e; }
.stat-card-icon.orange { background: rgba(255,102,0,0.1); color: #FF6600; }
.stat-card-icon.purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.stat-card-icon.red { background: rgba(239,68,68,0.1); color: #ef4444; }

.stat-card-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 2px;
}

.stat-card-info p {
    font-size: 13px;
    color: #999;
}

/* ========== ADMIN TABLE ========== */
.admin-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.admin-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-card-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: #333;
}

.admin-card-body {
    padding: 24px;
}

.admin-card-body.no-padding { padding: 0; }

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

.admin-table thead th {
    background: #f8f9fa;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    border-bottom: 1px solid #eee;
}

.admin-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #444;
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: #fafafa;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table .product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-table .product-cell img {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 8px;
    background: #f0f0f0;
}

.admin-table .product-cell .name {
    font-weight: 600;
    color: #333;
}

.admin-table .product-cell .sku {
    font-size: 12px;
    color: #999;
}

/* ========== ADMIN BUTTONS ========== */
.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: #555;
    font-family: inherit;
    text-decoration: none;
}

.admin-btn:hover {
    border-color: #bbb;
    background: #f8f9fa;
}

.admin-btn-primary {
    background: #FF6600;
    color: #fff;
    border-color: #FF6600;
}

.admin-btn-primary:hover {
    background: #e55a00;
    border-color: #e55a00;
}

.admin-btn-success {
    background: #22c55e;
    color: #fff;
    border-color: #22c55e;
}

.admin-btn-danger {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

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

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

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

/* ========== ADMIN FORMS ========== */
.admin-form-group {
    margin-bottom: 18px;
}

.admin-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.admin-form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.admin-form-control:focus {
    border-color: #FF6600;
    box-shadow: 0 0 0 3px rgba(255,102,0,0.1);
}

select.admin-form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%23666' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.admin-form-control {
    resize: vertical;
    min-height: 100px;
}

.admin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.admin-form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.admin-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.admin-checkbox input { width: 18px; height: 18px; accent-color: #FF6600; }

/* ========== ADMIN MODAL ========== */
.admin-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.admin-modal-overlay.show { display: flex; }

.admin-modal {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.admin-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-modal-header h3 { font-size: 17px; }

.admin-modal-close {
    background: #f0f0f0;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-modal-body { padding: 24px; }
.admin-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========== LOGIN PAGE ========== */
.admin-login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.admin-login-card .logo {
    text-align: center;
    margin-bottom: 30px;
}

.admin-login-card .logo i {
    font-size: 48px;
    color: #FF6600;
    margin-bottom: 10px;
    display: block;
}

.admin-login-card .logo h2 {
    font-size: 22px;
    color: #1a1a2e;
}

.admin-login-card .logo h2 span { color: #FF6600; }

/* ========== IMAGE UPLOAD ========== */
.image-upload-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.image-upload-area:hover {
    border-color: #FF6600;
    background: rgba(255,102,0,0.02);
}

.image-upload-area i {
    font-size: 36px;
    color: #ccc;
    margin-bottom: 10px;
    display: block;
}

.image-upload-area p { font-size: 14px; color: #999; }

.image-preview-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.image-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== RESPONSIVE ADMIN ========== */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .admin-sidebar {
        width: 0;
        overflow: hidden;
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        width: 260px;
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .mobile-sidebar-toggle {
        display: inline-flex !important;
    }

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

    .admin-form-row, .admin-form-row-3 { grid-template-columns: 1fr; }

    .admin-content { padding: 15px; }

    .admin-topbar {
        padding: 15px;
    }

    .admin-topbar h1 {
        font-size: 18px;
    }

    .admin-card-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .admin-card-header h3 {
        font-size: 15px;
    }

    .admin-table {
        font-size: 13px;
    }

    .admin-table thead th {
        padding: 10px 12px;
        font-size: 11px;
    }

    .admin-table tbody td {
        padding: 12px;
    }

    .admin-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Overlay para mobile quando sidebar está aberta */
    .admin-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }

    .admin-sidebar.open + .admin-sidebar-overlay {
        display: block;
    }
}

@media (max-width: 480px) {
    .admin-sidebar-header img {
        height: 40px;
    }

    .admin-sidebar-header h2 {
        font-size: 14px;
    }

    .admin-sidebar-header small {
        font-size: 9px;
    }

    .admin-menu a {
        padding: 12px 15px;
        font-size: 13px;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-card-icon {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .stat-card-info h3 {
        font-size: 20px;
    }

    .admin-card-body {
        padding: 18px;
    }

    .admin-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
