/* ============================================
   ADMIN PANEL - MATCHING GALLERY DESIGN
   ============================================ */

/* CSS Variables - Same as main site */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    
    --accent-primary: #c9a86c;
    --accent-secondary: #e8d5b7;
    --accent-glow: rgba(201, 168, 108, 0.4);
    
    --text-primary: #f5f5f5;
    --text-secondary: #a8a8b3;
    --text-muted: #6b6b78;
    
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.06);
    
    --success: #4ade80;
    --success-bg: rgba(74, 222, 128, 0.1);
    --error: #f87171;
    --error-bg: rgba(248, 113, 113, 0.1);
    
    --font-display: 'Playfair Display', serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;
    
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.2s var(--ease-smooth);
    --transition-base: 0.3s var(--ease-smooth);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-glow);
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Animated Background */
.bg-shapes {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, #c9a86c20, #8b6914);
    top: -200px;
    right: -200px;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #4a3f6910, #2d1f5c);
    bottom: -150px;
    left: -150px;
    animation-delay: -7s;
}

.shape-3 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #1a4a4a15, #0a2a2a);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 30px) scale(1.02); }
}

/* ============================================
   BACK BUTTON
   ============================================ */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-base);
}

.back-button:hover {
    background: var(--glass-hover);
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
}

.back-button i {
    font-size: 0.85rem;
}

/* ============================================
   LOGIN CONTAINER
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container .back-button {
    position: absolute;
    top: 2rem;
    left: 2rem;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: fadeSlideIn 0.5s var(--ease-smooth);
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--accent-primary), #a88a50);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--bg-primary);
    box-shadow: var(--shadow-glow);
}

.login-card h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    transition: var(--transition-base);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(201, 168, 108, 0.1);
}

.input-group input:focus + i,
.input-group:focus-within i {
    color: var(--accent-primary);
}

.login-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent-primary), #a88a50);
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--bg-primary);
    cursor: pointer;
    transition: var(--transition-base);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 0 30px var(--accent-glow);
}

/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-panel {
    display: none;
    min-height: 100vh;
}

/* Admin Header */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(18, 18, 26, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.header-left,
.header-right {
    flex: 1;
}

.header-right {
    display: flex;
    justify-content: flex-end;
}

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

.admin-logo {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--accent-primary), #a88a50);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--bg-primary);
}

.admin-title h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
}

.admin-title p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--success-bg);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--success);
}

.status-badge i {
    font-size: 0.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Admin Main */
.admin-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Sections */
.upload-section,
.manage-section {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.section-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--accent-primary), #a88a50);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--bg-primary);
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
}

.section-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   UPLOAD FORM
   ============================================ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.form-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group label i {
    color: var(--accent-primary);
    font-size: 0.85rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition-base);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(201, 168, 108, 0.1);
}

/* Select dropdown options styling */
.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem;
}

.form-group select option:hover,
.form-group select option:focus {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.form-group select option:checked {
    background: linear-gradient(135deg, var(--accent-primary), #a88a50);
    color: var(--bg-primary);
}

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

/* Select Wrapper */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    padding-right: 2.5rem;
    cursor: pointer;
}

.select-wrapper i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.8rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Upload Area */
.upload-area {
    height: 100%;
}

.upload-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 350px;
    background: var(--glass-bg);
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-base);
    overflow: hidden;
}

.upload-dropzone:hover {
    border-color: var(--accent-primary);
    background: var(--glass-hover);
}

.upload-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.dropzone-content {
    text-align: center;
    padding: 2rem;
    transition: var(--transition-base);
}

.dropzone-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: rgba(201, 168, 108, 0.1);
    border: 1px solid rgba(201, 168, 108, 0.2);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--accent-primary);
}

.dropzone-content h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.dropzone-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.file-types {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Preview Container */
.preview-container {
    position: absolute;
    inset: 0;
    display: none;
}

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

.preview-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 15, 0.8);
    opacity: 0;
    transition: var(--transition-base);
}

.preview-container:hover .preview-overlay {
    opacity: 1;
}

.preview-overlay i {
    font-size: 2rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.preview-overlay span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* When image is loaded */
.upload-dropzone.has-preview .dropzone-content {
    display: none;
}

.upload-dropzone.has-preview .preview-container {
    display: block;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #a88a50);
    border: none;
    color: var(--bg-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 0 30px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--glass-hover);
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
}

/* ============================================
   ARTWORK GRID
   ============================================ */
.artwork-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.artwork-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-base);
}

.artwork-item:hover {
    border-color: rgba(201, 168, 108, 0.3);
    transform: translateY(-4px);
}

.artwork-item img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.artwork-item .info {
    padding: 1rem;
}

.artwork-item h4 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.artwork-item p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.artwork-item .actions {
    padding: 0 1rem 1rem;
}

.delete-btn {
    width: 100%;
    padding: 0.6rem;
    background: var(--error-bg);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--error);
    cursor: pointer;
    transition: var(--transition-base);
}

.delete-btn:hover {
    background: var(--error);
    color: white;
}

/* Loading Placeholder */
.loading-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
}

.loader {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
}

.loader-inner {
    width: 100%;
    height: 100%;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-placeholder p {
    color: var(--text-secondary);
}

/* ============================================
   MESSAGE BOX
   ============================================ */
.message-box {
    display: none;
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s var(--ease-smooth);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message-box.success {
    border-color: rgba(74, 222, 128, 0.3);
}

.message-box.success .message-icon {
    background: var(--success-bg);
    color: var(--success);
}

.message-box.error {
    border-color: rgba(248, 113, 113, 0.3);
}

.message-box.error .message-icon {
    background: var(--error-bg);
    color: var(--error);
}

.message-box.error .message-icon i::before {
    content: "\f00d";
}

.message-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.message-text {
    font-size: 0.95rem;
    font-weight: 500;
}

.close-message {
    background: none;
    border: none;
    padding: 0.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.close-message:hover {
    color: var(--text-primary);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .upload-dropzone {
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .header-left,
    .header-right {
        width: 100%;
        justify-content: center;
    }

    .admin-main {
        padding: 1rem;
    }

    .upload-section,
    .manage-section {
        padding: 1.5rem;
    }

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

    .form-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .artwork-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .login-container .back-button {
        position: static;
        margin-bottom: 2rem;
    }

    .login-card {
        padding: 2rem;
    }

    .message-box {
        left: 1rem;
        right: 1rem;
        top: 1rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

::selection {
    background: var(--accent-primary);
    color: var(--bg-primary);
}
