/* ===== MODERN ADMIN PANEL STYLES ===== */

.admin-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    z-index: 1000;
    overflow: hidden;
}

/* Hide main app when admin panel is open */
.admin-container ~ * {
    display: none !important;
}

/* ===== MODERN HEADER ===== */
.admin-header-modern {
    background: white;
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.admin-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-title {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.admin-subtitle {
    font-size: 13px;
    color: #999;
    margin: 0;
    font-weight: 500;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.health-indicator-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-radius: 8px;
    border: 1px solid #86efac;
    font-size: 13px;
    font-weight: 600;
    color: #15803d;
}

.status-dot-modern {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #15803d;
    animation: pulse-modern 2s infinite;
}

@keyframes pulse-modern {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.back-to-gantt-btn-modern {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.back-to-gantt-btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

.back-to-gantt-btn-modern:active {
    transform: translateY(0);
}

/* ===== MODERN TAB NAVIGATION ===== */
.admin-tabs-modern {
    background: white;
    padding: 16px 32px;
    border-bottom: 2px solid #f3f4f6;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.05);
}

.admin-tabs-modern::-webkit-scrollbar {
    height: 4px;
}

.admin-tabs-modern::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.admin-tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    position: relative;
}

.admin-tab-btn:hover {
    color: #111827;
    background: rgba(59, 130, 246, 0.05);
    border-bottom-color: #bfdbfe;
}

.admin-tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.tab-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
}

.tab-label {
    font-weight: 600;
}

/* ===== MODERN CONTENT AREA ===== */
.admin-content-modern {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.admin-content-modern::-webkit-scrollbar {
    width: 10px;
}

.admin-content-modern::-webkit-scrollbar-track {
    background: transparent;
}

.admin-content-modern::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 5px;
}

.admin-content-modern::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ===== METRICS GRID ===== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.metric-card {
    background: white;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.metric-label {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 12px;
    letter-spacing: 0.8px;
}

.metric-value {
    font-size: 36px;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 8px;
}

.metric-subtitle {
    font-size: 13px;
    color: #9ca3af;
    font-weight: 500;
}

/* ===== CONTENT HEADINGS ===== */
.admin-content-modern h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 28px;
    margin-top: 0;
}

/* ===== PLACEHOLDER CONTENT ===== */
.admin-content-modern p {
    color: #6b7280;
    padding: 24px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    font-size: 14px;
    line-height: 1.6;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .admin-header-modern {
        padding: 20px 24px;
    }

    .admin-tabs-modern {
        padding: 12px 24px;
    }

    .admin-content-modern {
        padding: 24px;
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 16px;
    }

    .metric-card {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .admin-header-modern {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
        padding: 16px 20px;
    }

    .admin-title {
        font-size: 22px;
    }

    .admin-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .admin-tabs-modern {
        padding: 12px 20px;
        gap: 8px;
    }

    .admin-tab-btn {
        padding: 8px 12px;
        font-size: 12px;
        gap: 4px;
    }

    .tab-icon {
        font-size: 14px;
    }

    .admin-content-modern {
        padding: 16px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .metric-value {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .admin-header-modern {
        padding: 12px 16px;
    }

    .admin-title {
        font-size: 18px;
    }

    .admin-subtitle {
        display: none;
    }

    .health-indicator-modern {
        font-size: 11px;
        padding: 6px 12px;
    }

    .back-to-gantt-btn-modern {
        padding: 8px 16px;
        font-size: 12px;
    }

    .admin-tabs-modern {
        padding: 8px 16px;
    }

    .admin-tab-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .tab-label {
        display: none;
    }

    .admin-content-modern {
        padding: 12px;
    }
}

/* ========================================
   PHASE 1.2: GRID SETTINGS SECTION STYLES
   ======================================== */

.admin-grid-settings-section {
    padding: 20px;
}

.admin-grid-settings-section .section-header {
    margin-bottom: 24px;
}

.admin-grid-settings-section .section-header h2 {
    margin: 0 0 8px 0;
    color: #1a1a2e;
}

.admin-grid-settings-section .section-description {
    color: #666;
    margin: 0;
}

/* Settings Selector Card */
.settings-selector-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid #e0e0e0;
}

.selector-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.selector-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.selector-group label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.settings-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 180px;
}

/* Settings Cards Grid */
.settings-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.settings-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.settings-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.settings-card .card-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
}

.settings-card .card-content {
    padding: 16px;
}

.settings-card .help-text {
    font-size: 12px;
    color: #666;
    margin: 0 0 12px 0;
}

/* Permission Toggle */
.permission-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.permission-toggle label {
    font-size: 11px;
    color: #888;
}

.permission-select-sm {
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

/* Column Grid (visibility checkboxes) */
.column-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.column-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
}

.column-item input[type="checkbox"] {
    margin: 0;
}

.column-item .lock-indicator {
    font-size: 10px;
    margin-left: auto;
}

/* Column Order List (drag-to-reorder) */
.column-order-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    cursor: grab;
}

.order-item.locked {
    background: #f0f0f0;
    cursor: not-allowed;
}

.order-item .drag-handle {
    color: #888;
    cursor: grab;
}

.order-item.locked .drag-handle {
    cursor: not-allowed;
    color: #ccc;
}

.order-item .field-name {
    flex: 1;
    font-size: 13px;
}

.order-item .position-badge {
    background: #6A4CFF;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    min-width: 24px;
    text-align: center;
}

.order-item.locked .position-badge {
    background: #999;
}

/* Radio Group (formatting mode) */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.radio-option:hover {
    border-color: #6A4CFF;
}

.radio-option input[type="radio"] {
    margin-top: 3px;
}

.radio-content {
    display: flex;
    flex-direction: column;
}

.radio-content strong {
    font-size: 13px;
    margin-bottom: 2px;
}

.radio-content span {
    font-size: 11px;
    color: #666;
}

/* Slider Group */
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-group label {
    font-size: 13px;
    font-weight: 500;
}

.slider {
    width: 100%;
    cursor: pointer;
}

/* Frozen Preview */
.frozen-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px;
    background: #f0f4ff;
    border-radius: 4px;
    font-size: 12px;
}

.frozen-col {
    background: #6A4CFF;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
}

.frozen-preview .divider {
    color: #999;
    font-weight: bold;
}

.unfrozen-col {
    color: #666;
    font-style: italic;
}

/* Width Presets */
.width-presets {
    display: flex;
    gap: 8px;
}

.preset-btn {
    flex: 1;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: #6A4CFF;
}

.preset-btn.active {
    background: #6A4CFF;
    color: white;
    border-color: #6A4CFF;
}

/* Settings Actions */
.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 24px;
}

/* Settings Info Card */
.settings-info-card {
    background: #f0f4ff;
    border-radius: 8px;
    padding: 16px;
    border-left: 4px solid #6A4CFF;
}

.settings-info-card h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #1a1a2e;
}

.settings-info-card ul {
    margin: 0;
    padding-left: 20px;
}

.settings-info-card li {
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}

.settings-info-card li strong {
    color: #333;
}

/* Responsive adjustments for Grid Settings */
@media (max-width: 768px) {
    .settings-cards-grid {
        grid-template-columns: 1fr;
    }

    .selector-row {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-select {
        width: 100%;
    }
}

/* ── System Sub-Tabs ── */
.system-subtab-bar {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px 8px 0 0;
}

.system-subtab-btn {
    padding: 10px 18px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.system-subtab-btn:hover {
    color: #111827;
    background: rgba(59,130,246,0.05);
}

.system-subtab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: rgba(59,130,246,0.08);
}

/* Version Source Badges */
.version-source-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.version-source-badge.imported {
    background: #dbeafe;
    color: #1e40af;
}
.version-source-badge.generated {
    background: #dcfce7;
    color: #166534;
}
.version-source-badge.recalculated {
    background: #fef3c7;
    color: #92400e;
}
