/* ============================================
   HDHS Admin - Modern Block Editor (Gutenberg-style)
   ============================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-dark: #1e1e1e;
    --bg-darker: #171717;
    --bg-light: #2d2d2d;
    --bg-lighter: #3d3d3d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border: #404040;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* Login Screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.login-header h1 {
    color: #1e1e1e;
    font-size: 28px;
    margin-bottom: 5px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

/* Robot Verification */
.robot-verification {
    text-align: center;
}

.robot-text {
    font-size: 18px;
    margin-bottom: 20px;
    color: #1e1e1e;
}

.robot-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
}

.robot-btn {
    font-size: 50px;
    padding: 15px 25px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.robot-btn:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.robot-hint {
    font-size: 14px;
    color: #666;
    min-height: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #1e1e1e;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}


/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg-light);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-logout {
    background: var(--danger);
    color: white;
    padding: 8px 16px;
}

/* Admin Dashboard */
.admin-dashboard {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Navigation */
.admin-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border);
}

.admin-nav-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-logo {
    font-size: 20px;
    font-weight: 700;
    font-family: 'Oswald', sans-serif;
}

.admin-beta {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.admin-nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.admin-email {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Admin Body */
.admin-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.admin-sidebar {
    width: 250px;
    background: var(--bg-darker);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-btn {
    width: 100%;
    padding: 15px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    font-size: 14px;
    font-family: inherit;
}

.sidebar-btn:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.sidebar-btn.active {
    background: var(--primary);
    color: white;
}

.sidebar-icon {
    font-size: 20px;
}

/* Main Content */
.admin-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: var(--bg-dark);
}

/* Block Editor */
.block-editor {
    max-width: 900px;
    margin: 0 auto;
}

.editor-header {
    margin-bottom: 30px;
}

.editor-header h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.editor-header p {
    color: var(--text-secondary);
}

.editor-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-darker);
    border-radius: 10px;
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 10px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.3s;
}

.toolbar-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Blocks Container */
.blocks-container {
    background: var(--bg-darker);
    border-radius: 10px;
    padding: 20px;
    min-height: 500px;
}

.block-item {
    background: var(--bg-light);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    cursor: move;
    transition: all 0.3s;
}

.block-item:hover {
    border-color: var(--primary);
}

.block-item.dragging {
    opacity: 0.5;
}

.block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.block-type {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

.block-actions {
    display: flex;
    gap: 8px;
}

.block-action-btn {
    padding: 6px 12px;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
}

.block-action-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.block-action-btn.delete:hover {
    background: var(--danger);
    border-color: var(--danger);
}

.block-content {
    padding: 10px 0;
}

.block-content input,
.block-content textarea {
    width: 100%;
    padding: 10px;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
}

.block-content textarea {
    min-height: 100px;
    resize: vertical;
}

.block-content input:focus,
.block-content textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Image Block */
.image-block-preview {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 6px;
    margin-top: 10px;
}

/* Content Section */
.content-section {
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 28px;
}

.card {
    background: var(--bg-darker);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 20px;
}

.badge {
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Items List */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.item-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s;
}

.item-card:hover {
    border-color: var(--primary);
}

.item-card.dragging {
    opacity: 0.5;
}

.drag-handle {
    cursor: move;
    font-size: 20px;
    color: var(--text-secondary);
}

.item-info {
    flex: 1;
}

.item-info h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

.item-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.item-actions {
    display: flex;
    gap: 8px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 60px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-darker);
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 22px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Image Upload */
.image-upload {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.image-upload:hover {
    border-color: var(--primary);
    background: var(--bg-light);
}

.image-upload-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.image-upload p {
    color: var(--text-secondary);
    font-size: 14px;
}

.image-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 10px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--success);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 2000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: var(--danger);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-lighter);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar {
        width: 70px;
    }

    .sidebar-btn span:not(.sidebar-icon) {
        display: none;
    }

    .admin-content {
        padding: 15px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}