/* ==============================================
   ImgHost — Admin CSS
   ============================================== */
:root {
    --a-bg: #0b0e1a;
    --a-surface: #111527;
    --a-card: #161b32;
    --a-border: rgba(255, 255, 255, 0.07);
    --a-accent: #6c63ff;
    --a-text: #e8eaf6;
    --a-muted: rgba(255, 255, 255, 0.4);
    --a-success: #00c897;
    --a-danger: #ff5c6c;
    --a-sw: 240px;
    --a-r: 12px;
    --a-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--a-bg);
    color: var(--a-text);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Sidebar */
.a-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--a-sw);
    height: 100vh;
    background: var(--a-surface);
    border-right: 1px solid var(--a-border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    transition: transform 0.3s;
}

.a-logo {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--a-border);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.a-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6c63ff, #857dff);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
}

.a-logo span {
    font-weight: 800;
    font-size: 1rem;
}

.a-nav {
    padding: 0.75rem;
    flex: 1;
}

.a-nav-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--a-muted);
    padding: 0.625rem 0.75rem 0.25rem;
}

.a-nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.8rem;
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.a-nav-link i {
    font-size: 0.95rem;
    min-width: 18px;
}

.a-nav-link:hover {
    background: rgba(108, 99, 255, 0.1);
    color: #fff;
}

.a-nav-link.active {
    background: rgba(108, 99, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(108, 99, 255, 0.25);
}

.a-sidebar-foot {
    padding: 0.75rem;
    border-top: 1px solid var(--a-border);
}

.a-sidebar-foot a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.8rem;
    border-radius: 9px;
    color: var(--a-muted);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.a-sidebar-foot a:hover {
    background: rgba(255, 92, 108, 0.1);
    color: #ff8a95;
}

/* Main */
.a-main {
    margin-left: var(--a-sw);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.a-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11, 14, 26, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--a-border);
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.a-topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.a-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #6c63ff, #857dff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: #fff;
}

.a-content {
    padding: 1.5rem;
    flex: 1;
}

/* Cards */
.a-stat-card {
    background: var(--a-card);
    border: 1px solid var(--a-border);
    border-radius: var(--a-r);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: all 0.25s;
}

.a-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--a-shadow);
}

.a-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-color, linear-gradient(90deg, #6c63ff, #857dff));
}

.a-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(108, 99, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--a-accent);
    margin-bottom: 0.875rem;
}

.a-stat-val {
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1;
}

.a-stat-lbl {
    font-size: 0.8rem;
    color: var(--a-muted);
    margin-top: 0.25rem;
}

.a-card {
    background: var(--a-card);
    border: 1px solid var(--a-border);
    border-radius: var(--a-r);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.a-card-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--a-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.a-card-head h6 {
    font-weight: 700;
    font-size: 0.9rem;
    margin: 0;
}

.a-card-body {
    padding: 1.25rem;
}

/* Table */
.a-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.a-table th {
    padding: 0.65rem 1rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--a-muted);
    border-bottom: 1px solid var(--a-border);
}

.a-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.a-table tr:last-child td {
    border-bottom: none;
}

.a-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.a-thumb {
    width: 52px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    display: block;
}

.a-thumb-placeholder {
    width: 52px;
    height: 40px;
    border-radius: 6px;
    background: var(--a-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--a-muted);
    font-size: 1.1rem;
}

/* Grid */
.img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    padding: 1.25rem;
}

.img-grid-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: var(--a-surface);
    aspect-ratio: 1;
    cursor: pointer;
    transition: all 0.25s;
}

.img-grid-item:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.img-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.img-grid-item .img-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.img-grid-item:hover .img-overlay {
    opacity: 1;
}

.btn-del-overlay {
    background: var(--a-danger);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-del-overlay:hover {
    transform: scale(1.1);
}

/* Buttons */
.a-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 9px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.a-btn-primary {
    background: linear-gradient(135deg, #6c63ff, #857dff);
    color: #fff;
}

.a-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.4);
}

.a-btn-danger {
    background: rgba(255, 92, 108, 0.15);
    color: #ff8a95;
    border: 1px solid rgba(255, 92, 108, 0.25);
}

.a-btn-danger:hover {
    background: rgba(255, 92, 108, 0.25);
}

.a-btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: var(--a-text);
    border: 1px solid var(--a-border);
}

.a-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
}

.a-btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
}

/* Forms */
.a-form-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--a-muted);
    display: block;
    margin-bottom: 0.35rem;
}

.a-form-ctrl {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--a-text) !important;
    border-radius: 9px !important;
    padding: 0.55rem 0.875rem !important;
    font-size: 0.875rem;
    width: 100%;
    font-family: inherit;
    transition: all 0.2s;
}

.a-form-ctrl:focus {
    background: rgba(108, 99, 255, 0.06) !important;
    border-color: rgba(108, 99, 255, 0.4) !important;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12) !important;
    outline: none;
}

.a-form-ctrl::placeholder {
    color: rgba(255, 255, 255, 0.2) !important;
}

select.a-form-ctrl option {
    background: #161b32;
}

.a-form-group {
    margin-bottom: 1rem;
}

.a-form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.a-form-check input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: var(--a-accent);
}

/* Alert */
.a-alert {
    border-radius: 9px;
    padding: 0.8rem 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.a-alert-success {
    background: rgba(0, 200, 151, 0.1);
    border: 1px solid rgba(0, 200, 151, 0.25);
    color: var(--a-success);
}

.a-alert-danger {
    background: rgba(255, 92, 108, 0.1);
    border: 1px solid rgba(255, 92, 108, 0.25);
    color: var(--a-danger);
}

/* Login */
.a-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, #0b0e1a 0%, #161b32 100%);
}

.a-login-card {
    background: rgba(22, 27, 50, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
}

.a-login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.a-login-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #6c63ff, #857dff);
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    box-shadow: 0 8px 30px rgba(108, 99, 255, 0.45);
    margin-bottom: 1rem;
}

/* Page header */
.a-page-head {
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.a-page-head h4 {
    font-weight: 800;
    font-size: 1.3rem;
    margin: 0;
}

.a-breadcrumb {
    font-size: 0.78rem;
    color: var(--a-muted);
    margin-top: 0.2rem;
}

.a-breadcrumb span {
    color: var(--a-accent);
}

/* Pagination */
.a-pagination {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.a-pag-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--a-border);
    background: var(--a-card);
    color: var(--a-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.a-pag-btn:hover,
.a-pag-btn.active {
    background: var(--a-accent);
    border-color: var(--a-accent);
    color: #fff;
}

/* Toggle view */
.view-toggle {
    display: flex;
    background: var(--a-surface);
    border: 1px solid var(--a-border);
    border-radius: 9px;
    overflow: hidden;
}

.view-toggle button {
    border: none;
    background: none;
    color: var(--a-muted);
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.view-toggle button.active {
    background: var(--a-accent);
    color: #fff;
}

/* Responsive */
@media (max-width: 991.98px) {
    .a-sidebar {
        transform: translateX(-100%);
    }

    .a-sidebar.open {
        transform: translateX(0);
    }

    .a-main {
        margin-left: 0;
    }
}

@media (max-width: 600px) {
    .img-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}