/**
 * Admin Panel Styles - v2.0
 * FIXED FLEXBOX VERSION
 * Last updated: 2025-11-25 00:30
 * Clean minimalist design - guaranteed full height
 */

/* === RESET === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: white;
    color: #333;
}

/* === MAIN CONTAINER (100vh) === */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* === HEADER (fixed height) === */
.header {
    flex: 0 0 auto;
    background: white;
    padding: 12px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 2px;
}

.subtitle {
    color: #666;
    font-size: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-name {
    font-size: 12px;
    color: #666;
}

/* === MESSAGES (fixed height when present) === */
.message {
    flex: 0 0 auto;
    padding: 10px 24px;
    font-size: 13px;
    border-bottom: 1px solid #e0e0e0;
}

.message.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.message.error {
    background: #ffebee;
    color: #c62828;
}

/* === FORM (takes remaining height) === */
#editorForm {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* === TOOLBAR (fixed height) === */
.toolbar {
    flex: 0 0 auto;
    background: #fafafa;
    padding: 10px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    align-items: center;
}

.file-select {
    flex: 1;
    max-width: 450px;
}

/* === EDITOR CONTAINER (takes all remaining space) === */
.editor-container {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}

/* === EDITOR PANEL === */
.editor-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
    min-height: 0;
}

.editor-panel.full {
    border-right: none;
}

.panel-header {
    flex: 0 0 auto;
    padding: 8px 20px;
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
    font-size: 10px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* === TEXTAREA (takes all space in panel) === */
textarea {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    padding: 16px;
    border: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    background: #fafafa;
    overflow: auto;
}

textarea:focus {
    outline: none;
    background: white;
}

/* === PREVIEW PANEL === */
.preview-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.preview-panel.full {
    border-right: none;
}

.preview-iframe {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border: none;
    background: white;
}

/* === BUTTONS === */
.btn {
    padding: 6px 14px;
    background: #f5f5f5;
    color: #333;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn:hover {
    background: #e0e0e0;
    border-color: #b0b0b0;
}

.btn-primary {
    padding: 8px 24px;
    background: #0078d4;
    color: white;
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    background: #006cbd;
}

.btn-primary:active {
    background: #005a9e;
}

.btn-secondary {
    padding: 8px 16px;
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
    color: #333;
}

/* === SELECT === */
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: white;
    cursor: pointer;
}

select:hover {
    border-color: #0078d4;
}

select:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.1);
}

/* === MODE TABS === */
.mode-tabs {
    display: flex;
    gap: 8px;
    margin-left: auto;
    margin-right: 16px;
}

.tab-btn {
    padding: 8px 20px;
    background: white;
    color: #666;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #f0f0f0;
}

.tab-btn.active {
    background: #0078d4;
    color: white;
    border-color: #0078d4;
}

/* === SCROLLBAR === */
textarea::-webkit-scrollbar {
    width: 12px;
}

textarea::-webkit-scrollbar-track {
    background: #f1f1f1;
}

textarea::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* === EMPTY STATE === */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    padding: 40px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* === UTILITIES === */
.hidden {
    display: none !important;
}

.mobile-mode-select {
    display: none;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .mode-tabs {
        display: none;
    }

    .mobile-mode-select {
        display: block;
        width: 140px;
    }

    .editor-container {
        flex-direction: column;
    }

    .editor-panel {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .user-info {
        width: 100%;
        justify-content: space-between;
    }

    .toolbar {
        flex-wrap: wrap;
    }

    .file-select {
        max-width: 100%;
    }
}