/* ==========================================================================
   1. CSS Variables (Admin Theme)
   ========================================================================== */
:root {
    --bg-color: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --brand-color: #d97706;
    --card-bg: #ffffff;
    --border-radius: 8px;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --card-bg: #1e293b;
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
}

/* ==========================================================================
   2. Base Reset & Typography
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ==========================================================================
   3. Admin Header & Navigation
   ========================================================================== */
.admin-header {
    background: #1e293b;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.admin-header h1 {
    color: white;
    font-size: 1.25rem;
    margin: 0;
}

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

.logout-btn { 
    color: #f87171; 
    text-decoration: none; 
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    width: 32px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    transition: all 0.2s; 
}

.logout-btn:hover {
    background: rgba(248, 113, 113, 0.2);
    color: #ef4444;
}

.hamburger-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.75rem;
    cursor: pointer;
    margin-right: 0.75rem;
    padding: 0;
    line-height: 1;
}

/* Language Selector */
.lang-selector {
    display: flex;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem;
    border-radius: 12px;
}

.lang-btn {
    border: none;
    background: transparent;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.2s ease;
}

.lang-btn.active {
    background: white;
    color: #1e293b;
}

/* ==========================================================================
   4. Admin Sidebar
   ========================================================================== */
.admin-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.admin-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--card-bg);
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

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

.admin-sidebar-header {
    padding: 1.5rem;
    background: #1e293b;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-sidebar-header h2 {
    font-size: 1.25rem;
    margin: 0;
    color: white;
}

.close-sidebar-btn {
    background: none;
    border: none;
    color: #cbd5e1;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.admin-sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    border-left: 4px solid transparent;
}

.admin-nav-link:hover {
    background: var(--bg-color);
}

.admin-nav-link.active {
    background: var(--bg-color);
    color: var(--brand-color);
    border-left-color: var(--brand-color);
}

.admin-nav-icon {
    margin-right: 1rem;
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* ==========================================================================
   5. Admin Main Content & Forms
   ========================================================================== */
.menu-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-md);
}

.admin-section {
    margin-bottom: 3rem;
}

.category-title {
    font-size: 1.75rem;
    border-bottom: 2px solid #cbd5e1;
    padding-bottom: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.admin-form-container { 
    background: white; 
    padding: 1.5rem; 
    border-radius: var(--border-radius); 
    box-shadow: var(--shadow-sm); 
    margin-bottom: 2rem; 
    border-top: 4px solid var(--brand-color); 
}

.admin-input-group { 
    background: #f8fafc; 
    padding: 1rem; 
    border-radius: 4px; 
    border: 1px solid #e2e8f0; 
}

.admin-label { 
    font-size: 0.85rem; 
    font-weight: bold; 
    color: #1e293b; 
    display: block; 
    margin-bottom: 0.25rem; 
}

.admin-input { 
    width: 100%; 
    padding: 0.5rem; 
    margin-bottom: 0.75rem; 
    border: 1px solid #cbd5e1; 
    border-radius: 4px; 
    font-size: 1rem;
}

.admin-input:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.1);
}

/* ==========================================================================
   6. Login Page Styles
   ========================================================================== */
.login-container {
    max-width: 400px;
    margin: 10vh auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.login-input {
    width: 100%;
    padding: 0.75rem;
    margin: 1rem 0;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
}

.login-btn {
    background: var(--brand-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.2s;
}

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

/* ==========================================================================
   7. Media Queries
   ========================================================================== */
@media (max-width: 768px) {
    .logout-btn { height: 28px; width: 28px; }
    .header-controls { gap: 0.5rem; }
    .admin-header h1 { font-size: 1.1rem; }
}

/* ==========================================================================
   8. Image Cropper & Upload Zone
   ========================================================================== */
.cropper-container {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    background: #e2e8f0;
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    user-select: none;
    touch-action: none;
}

.cropper-container img {
    display: block;
    max-width: 100%;
    height: auto;
    pointer-events: none;
}

.circle-mask {
    position: absolute;
    width: 200px; 
    height: 200px;
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
    border: 2px dashed rgba(255, 255, 255, 0.8);
    cursor: grab;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.circle-mask:active {
    cursor: grabbing;
}

.upload-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--brand-color);
    background: #f1f5f9;
}

.upload-icon {
    font-size: 3rem;
    color: #94a3b8;
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.1rem;
    color: #475569;
    font-weight: 500;
}

.upload-subtext {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}

.upload-dropzone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}


/* Hide header copyright on mobile */
@media (max-width: 768px) {
    .header-copyright-link {
        display: none !important;
    }
}
