/* Admin CSS */
:root {
    --primary: #6B17BF;
    --primary-dark: #5515a3;
    --secondary: #8B0B85;
    --success: #25D366;
    --danger: #EF0F10;
    --warning: #FEE163;
    --info: #3294FA;
    --dark: #141414;
    --gray: #666;
    --light: #F4F2F8;
    --white: #FFFFFF;
    --border: #E0E0E0;
    --shadow: 0 4px 20px rgba(0,0,0,0.1);
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--light);
    color: var(--dark);
}

/* Login Screen */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 20px;
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.login-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.login-box h1 {
    color: var(--primary);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

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

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

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

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

.error-message {
    background: #fee;
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 0.9rem;
}

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

.sidebar {
    width: 260px;
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

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

.sidebar-header h2 {
    color: var(--primary);
    font-size: 1.2rem;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--gray);
    text-decoration: none;
    transition: all 0.3s;
    margin-bottom: 4px;
}

.nav-item:hover {
    background: var(--light);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
}

.nav-item.logout {
    color: var(--danger);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
}

.page-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    font-size: 1.5rem;
    color: var(--dark);
}

.page-header p {
    color: var(--gray);
    margin-top: 4px;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.card h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--dark);
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

/* Upload */
.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.upload-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--light);
}

.upload-area input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-placeholder {
    color: var(--gray);
    font-size: 0.9rem;
}

.preview-img {
    max-width: 100%;
    max-height: 100px;
    border-radius: 8px;
}

.banner-uploads {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.banner-slide {
    min-height: 80px;
    padding: 12px;
}

.banner-slide .preview-img {
    max-width: 100%;
    max-height: 60px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

.banner-slide .remove-banner {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.btn-remove {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.3s;
}

.btn-remove:hover {
    background: #c00d0e;
}

/* List */
.list-header {
    display: grid;
    grid-template-columns: 1fr 100px 120px;
    padding: 12px 16px;
    background: var(--light);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 12px;
}

.sortable-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-item {
    display: grid;
    grid-template-columns: 40px 1fr 80px 100px 120px;
    align-items: center;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s;
}

.list-item:hover {
    border-color: var(--primary);
}

.list-item-icon {
    font-size: 1.2rem;
    margin-right: 12px;
    color: var(--primary);
}

.list-item-title {
    font-weight: 600;
}

.list-item-url {
    font-size: 0.8rem;
    color: var(--gray);
}

.list-item-actions {
    display: flex;
    gap: 8px;
}

.list-item-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.list-item-actions .edit {
    background: var(--info);
    color: var(--white);
}

.list-item-actions .delete {
    background: var(--danger);
    color: var(--white);
}

.toggle {
    position: relative;
    width: 48px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: var(--white);
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: var(--success);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* Color Grid */
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.color-grid input[type="color"] {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-item input {
    width: 18px;
    height: 18px;
}

/* Preview */
.preview-box {
    background: linear-gradient(160deg, #6B17BF 0%, #8B0B85 100%);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .list-header,
    .list-item {
        grid-template-columns: 1fr;
    }
    
    .list-header span:not(:first-child),
    .list-item-actions {
        display: none;
    }
}

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

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stats-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stats-item-icon {
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.stats-item-title {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.stats-item-value {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

/* Drag and Drop */
.sortable-list .list-item {
    cursor: grab;
}

.sortable-list .list-item:active {
    cursor: grabbing;
}

.sortable-list .list-item.dragging {
    opacity: 0.5;
    background: #e0e0e0;
}

.list-item .drag-handle {
    cursor: grab;
    color: #999;
    padding: 8px;
    margin-right: 10px;
}

.list-item .drag-handle:hover {
    color: var(--primary);
}

.list-header span:nth-child(1) { flex: 2; }
.list-header span:nth-child(2) { width: 50px; text-align: center; }
.list-header span:nth-child(3) { width: 80px; text-align: center; }
.list-header span:nth-child(4) { width: 150px; text-align: right; }
