* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: #050505;
    color: #fff;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1208 100%);
}

.login-box {
    background: #0c0c0c;
    border: 1px solid #c69c4d;
    border-radius: 10px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 0 40px rgba(198, 156, 77, 0.15);
}

.login-box h1 {
    color: #c69c4d;
    text-align: center;
    margin-bottom: 8px;
    font-size: 28px;
}

.login-box p {
    text-align: center;
    color: #888;
    margin-bottom: 30px;
    font-size: 14px;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
    font-size: 14px;
}

.login-box input {
    width: 100%;
    padding: 12px 15px;
    background: #111;
    border: 1px solid #333;
    border-radius: 5px;
    color: #fff;
    font-size: 15px;
    transition: border-color 0.3s;
}

.login-box input:focus {
    outline: none;
    border-color: #c69c4d;
}

.login-box button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(#d9b36d, #8b5d14);
    border: none;
    border-radius: 5px;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s;
}

.login-box button:hover {
    opacity: 0.9;
}

.login-box .back-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: #888;
    font-size: 14px;
}

.login-box .back-link:hover {
    color: #c69c4d;
}

/* Admin Layout */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #0b0b0b;
    border-right: 1px solid #c69c4d;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid #222;
}

.sidebar-header h2 {
    color: #c69c4d;
    font-size: 20px;
}

.sidebar-header span {
    color: #666;
    font-size: 12px;
}

.sidebar nav {
    flex: 1;
    padding: 15px 0;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 25px;
    color: #aaa;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: #111;
    color: #c69c4d;
    border-left-color: #c69c4d;
}

.sidebar nav a i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #222;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: #888;
    font-size: 14px;
    border-radius: 5px;
    transition: all 0.3s;
}

.sidebar-footer a:hover {
    background: #111;
    color: #c69c4d;
}

.sidebar-footer .logout-btn {
    color: #c0392b;
}

.sidebar-footer .logout-btn:hover {
    color: #e74c3c;
}

.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 30px 40px;
}

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

.admin-header h1 {
    color: #c69c4d;
    font-size: 26px;
}

.admin-header .user-info {
    color: #888;
    font-size: 14px;
}

.admin-header .user-info i {
    color: #c69c4d;
    margin-right: 5px;
}

.menu-toggle{
    display:none;
    width:42px;
    height:42px;
    border:1px solid #333;
    border-radius:7px;
    background:#111;
    color:#c69c4d;
    font-size:18px;
    cursor:pointer;
}

.sidebar-backdrop{
    display:none;
}

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

.stat-card {
    background: #0c0c0c;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 25px;
    transition: border-color 0.3s;
}

.stat-card:hover {
    border-color: #c69c4d;
}

.stat-card .icon {
    width: 45px;
    height: 45px;
    background: rgba(198, 156, 77, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c69c4d;
    font-size: 20px;
    margin-bottom: 15px;
}

.stat-card h3 {
    font-size: 28px;
    color: #fff;
    margin-bottom: 5px;
}

.stat-card p {
    color: #888;
    font-size: 14px;
}

/* Panel */
.panel {
    background: #0c0c0c;
    border: 1px solid #222;
    border-radius: 8px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #222;
}

.panel-header h2 {
    color: #c69c4d;
    font-size: 18px;
}

.panel-subtitle{
    color:#888;
    font-size:13px;
    margin-top:6px;
}

.grid-preview-toolbar{
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:8px;
    margin-bottom:12px;
    color:#aaa;
}

.preview-device{
    padding:8px 12px;
    border:1px solid #333;
    border-radius:5px;
    background:#111;
    color:#aaa;
    cursor:pointer;
}

.preview-device.active{
    color:#fff;
    border-color:#c69c4d;
    background:#5e4518;
}

.grid-preview-frame{
    width:100%;
    margin:auto;
    padding:16px;
    border:1px solid #333;
    border-radius:10px;
    background:#080808;
    transition:max-width .25s;
}

.grid-preview-frame[data-device="tablet"]{max-width:720px}
.grid-preview-frame[data-device="mobile"]{max-width:360px}

.grid-preview{
    --preview-cols:5;
    --preview-gap:20px;
    --preview-radius:8px;
    --preview-ratio:4 / 3;
    display:grid;
    grid-template-columns:repeat(var(--preview-cols),minmax(0,1fr));
    gap:var(--preview-gap);
}

.preview-card{
    min-width:0;
    overflow:hidden;
    border:1px solid #333;
    border-radius:var(--preview-radius);
    background:#111;
}

.preview-image{
    display:flex;
    align-items:center;
    justify-content:center;
    aspect-ratio:var(--preview-ratio);
    color:#c69c4d;
    background:linear-gradient(135deg,#1d1d1d,#0b0b0b);
}

.preview-card span{
    display:block;
    padding:8px;
    color:#bbb;
    font-size:11px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.form-group input[type="range"]{
    accent-color:#c69c4d;
    padding:0;
}

.category-admin-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:18px;
    padding:22px;
}

.category-admin-card{
    min-width:0;
    padding:20px;
    border:1px solid #292929;
    border-radius:9px;
    background:#101010;
}

.category-card-summary{
    display:flex;
    align-items:flex-start;
    gap:14px;
    margin-bottom:18px;
}

.category-card-icon{
    flex:0 0 44px;
    width:44px;
    height:44px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:8px;
    color:#c69c4d;
    background:rgba(198,156,77,.14);
}

.category-card-info{min-width:0;flex:1}
.category-card-title{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:7px}
.category-card-title h3{min-width:0;color:#fff;font-size:17px;overflow-wrap:anywhere}
.category-card-info code{display:block;color:#c69c4d;margin-bottom:8px;overflow-wrap:anywhere}
.category-card-info p{color:#888;font-size:13px}
.category-primary-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
}

.category-primary-actions .btn{
    justify-content:center;
    text-align:center;
}

.category-primary-actions .category-edit-toggle{
    grid-column:1 / -1;
}

.category-edit-panel{margin-top:18px;padding-top:18px;border-top:1px solid #2b2b2b}
.category-edit-panel[hidden]{display:none}
.category-edit-panel .form-group{margin-bottom:15px}
.category-edit-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:18px}
.category-delete-form{margin-top:16px;padding-top:16px;border-top:1px solid #282828}

.selected-category-box{
    min-height:48px;
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 14px;
    border:1px solid rgba(198,156,77,.55);
    border-radius:6px;
    color:#c69c4d;
    background:rgba(198,156,77,.08);
}

.selected-category-box div{
    min-width:0;
    flex:1;
}

.selected-category-box strong,
.selected-category-box span{
    display:block;
}

.selected-category-box strong{color:#fff}
.selected-category-box span{color:#888;font-size:12px;margin-top:2px}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(#d9b36d, #8b5d14);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: #222;
    color: #ccc;
    border: 1px solid #333;
}

.btn-secondary:hover {
    border-color: #c69c4d;
    color: #c69c4d;
}

.btn-danger {
    background: #8b0000;
    color: #fff;
}

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

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

.btn-success {
    background: #1a6b1a;
    color: #fff;
}

.btn-success:hover {
    background: #228b22;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
}

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

table th,
table td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid #1a1a1a;
}

table th {
    background: #080808;
    color: #c69c4d;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    color: #ccc;
    font-size: 14px;
}

table tr:hover td {
    background: #0a0a0a;
}

table .product-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #333;
}

table .slide-thumb {
    width: 110px;
    height: 58px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #333;
    display: block;
}

table .sponsor-thumb {
    width: 100px;
    height: 75px;
    object-fit: contain;
    padding: 6px;
    background: #171717;
    border-radius: 5px;
    border: 1px solid #333;
    display: block;
}

.sponsor-preview-wrap{
    width:200px;
    height:150px;
    padding:8px;
    margin-top:10px;
    border:1px solid #333;
    border-radius:8px;
    background:#171717;
}

.sponsor-preview-wrap img{
    width:100%;
    height:100%;
    max-width:none;
    max-height:none;
    margin:0;
    object-fit:contain;
    border:0;
}

.form-help {
    color: #888;
    display: block;
    margin-top: 6px;
    font-size: 12px;
}

table .actions {
    display: flex;
    gap: 8px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(34, 139, 34, 0.2);
    color: #4caf50;
}

.badge-warning {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.badge-danger {
    background: rgba(139, 0, 0, 0.3);
    color: #e74c3c;
}

.badge-info {
    background: rgba(198, 156, 77, 0.2);
    color: #c69c4d;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 25px;
}

.form-group {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    background: #111;
    border: 1px solid #333;
    border-radius: 5px;
    color: #fff;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #c69c4d;
}

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

.form-group .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-group .checkbox-label input[type="checkbox"] {
    width: auto;
}

.form-actions {
    padding: 20px 25px;
    border-top: 1px solid #222;
    display: flex;
    gap: 10px;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: rgba(34, 139, 34, 0.15);
    border: 1px solid #228b22;
    color: #4caf50;
}

.alert-error {
    background: rgba(139, 0, 0, 0.15);
    border: 1px solid #8b0000;
    color: #e74c3c;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #333;
}

.empty-state p {
    margin-bottom: 20px;
}

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

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

    .category-admin-grid{
        grid-template-columns:1fr;
    }
}

.img-preview-wrap img{
    max-width:200px;
    max-height:200px;
    object-fit:cover;
    border-radius:8px;
    border:1px solid #333;
    margin-top:10px;
    display:block;
}

.img-preview-wrap span{
    display:block;
    color:#888;
    font-size:12px;
    margin-top:5px;
}

.form-group input[type="file"]{
    padding:10px;
    background:#111;
    border:1px dashed #444;
    border-radius:5px;
    color:#ccc;
    width:100%;
}

.form-group input[type="file"]::file-selector-button{
    background:#222;
    border:1px solid #c69c4d;
    color:#c69c4d;
    padding:8px 14px;
    border-radius:4px;
    cursor:pointer;
    margin-right:12px;
}
@media (max-width: 768px) {
    body.sidebar-open{
        overflow:hidden;
    }

    .sidebar {
        width: 100%;
        max-width:280px;
        height:100vh;
        position:fixed;
        transform:translateX(-100%);
        transition:transform .25s ease;
        z-index:1001;
    }

    body.sidebar-open .sidebar{transform:translateX(0)}

    .sidebar-backdrop{
        position:fixed;
        inset:0;
        z-index:1000;
        background:rgba(0,0,0,.72);
    }

    body.sidebar-open .sidebar-backdrop{display:block}

    .admin-main {
        margin-left: 0;
        padding: 18px;
        width:100%;
    }

    .admin-wrapper {
        display:block;
    }

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

    .admin-header{
        display:grid;
        grid-template-columns:auto 1fr auto;
        gap:12px;
    }

    .admin-header h1{
        font-size:21px;
    }

    .menu-toggle{display:inline-flex;align-items:center;justify-content:center}

    .form-grid{padding:18px}
    .form-actions{padding:16px 18px;flex-wrap:wrap}
    .panel-header{padding:18px}
    table th,table td{padding:12px}
}

@media (max-width: 480px) {
    .admin-header .user-info{font-size:0}
    .admin-header .user-info i{font-size:16px}
    .grid-preview-toolbar span{width:100%}
    .preview-device{flex:1;padding:8px 6px}
    .grid-preview-frame{padding:10px}
    .category-admin-grid{padding:14px}
    .category-admin-card{padding:16px}
    .category-card-title{align-items:flex-start;flex-direction:column}
    .category-edit-actions .btn{width:100%;justify-content:center}
    .category-primary-actions{grid-template-columns:1fr}
    .category-primary-actions .category-edit-toggle{grid-column:auto}
}
