/* ========================================
   ADMIN PANEL STYLES
   ======================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0f0f0f;
    color: #fff;
    min-height: 100vh;
}

.admin-container {
    display: none;
    /* Hidden by default until logged in */
    min-height: 100vh;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #000000;
    /* Force solid black */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    /* Maximum z-index */
}

.login-card {
    background: var(--bg-secondary);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.login-header {
    margin-bottom: 2rem;
}

.login-header .logo-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.login-header h2 {
    color: var(--gold);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
}

.btn-block {
    width: 100%;
    margin-top: 1rem;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #1a1a1a;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #d4af37;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-item.active {
    background: rgba(212, 175, 55, 0.15);
    color: #d4af37;
}

.nav-icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.preview-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    background: #1a1a1a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 50;
}

.main-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.content-area {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #d4af37;
    /* Fallback */
    background: linear-gradient(135deg, #d4af37 0%, #b8962e 100%);
    color: #0a0a0a;
    -webkit-appearance: none;
    appearance: none;
    opacity: 1 !important;
}

.btn-primary:hover,
.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    opacity: 1 !important;
}

.btn-primary:disabled {
    opacity: 1 !important;
    /* Prevent browser graying out */
    background: linear-gradient(135deg, #d4af37 0%, #b8962e 100%);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

/* Cards */
.card {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #d4af37;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    margin-bottom: 0;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(212, 175, 55, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Items List */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    transition: all 0.2s;
}

.item-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.item-card.editing {
    background: rgba(212, 175, 55, 0.05);
    border-color: rgba(212, 175, 55, 0.2);
}

.item-content {
    flex: 1;
}

.item-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.item-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
    max-height: 40px;
    overflow: hidden;
}

.item-actions {
    display: flex;
    gap: 8px;
}

.item-actions button {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.item-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.item-actions button.delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Edit Modal */
.edit-form {
    display: none;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.item-card.editing .item-content,
.item-card.editing .item-actions {
    display: none;
}

.item-card.editing .edit-form {
    display: flex;
}

.edit-form input,
.edit-form textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
}

.edit-form textarea {
    min-height: 60px;
    resize: vertical;
}

.edit-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Brand Logo Preview */
.brand-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 12px;
}

.brand-logo-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.brand-logo-placeholder {
    font-size: 18px;
    font-weight: 600;
    color: #d4af37;
}

.item-card .item-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.item-card .item-content .item-title {
    margin-bottom: 0;
}

.item-card .item-content .item-subtitle {
    margin-left: 12px;
    flex-shrink: 1;
}

.form-group-inline {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.form-group-inline input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
}

.form-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin: 8px 0 16px;
}

.form-hint code {
    background: rgba(212, 175, 55, 0.2);
    color: #d4af37;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 11px;
}

.logo-test-preview {
    min-height: 20px;
    margin-bottom: 12px;
}

.logo-test-preview img {
    max-width: 80px;
    max-height: 60px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
}

.logo-test-preview .error {
    color: #ef4444;
    font-size: 13px;
}

.logo-test-preview .loading {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
}

/* Sections */
.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: #1a1a1a;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d4af37;
    color: #0a0a0a;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
}

/* Card Description */
.card-description {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.card-description code {
    background: rgba(212, 175, 55, 0.2);
    color: #d4af37;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
}

/* Gold Button */
.btn-gold {
    background: linear-gradient(135deg, #d4af37 0%, #f4e4bc 50%, #d4af37 100%);
    color: #0a0a0a;
    font-weight: 600;
    background-size: 200% 200%;
    animation: goldShimmer 3s ease infinite;
}

@keyframes goldShimmer {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

/* Guide Steps */
.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guide-step {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.step-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #d4af37 0%, #b8962e 100%);
    color: #0a0a0a;
    font-weight: 700;
    font-size: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    margin-bottom: 4px;
    color: #fff;
}

.step-content p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
    margin: 0;
}

.step-content code {
    background: rgba(212, 175, 55, 0.2);
    color: #d4af37;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 12px;
        gap: 8px;
    }

    .nav-item {
        white-space: nowrap;
        margin-bottom: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .main-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .header-actions {
        justify-content: flex-end;
    }

    .content-area {
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Mobile Item Cards */
    .item-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .item-content {
        width: 100%;
        display: block;
        /* Break flex layout inside content */
    }

    .item-card .item-content .item-subtitle {
        margin-left: 0;
        margin-top: 4px;
    }

    .item-actions {
        width: 100%;
        justify-content: flex-end;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding-top: 12px;
    }

    .brand-preview {
        margin-bottom: 8px;
    }
}