/**
 * Styles for K56 Vorlage - Siegburger Sonne
 * Full-width input layout for maximum text editing space
 */

/* Page-specific overrides */
body.page-siegburger-sonne {
    background: linear-gradient(
        180deg,
        var(--sky-mist) 0%,
        rgba(174, 213, 129, 0.15) 50%,
        var(--sky-dawn) 100%
    );
    background-attachment: fixed;
}

* {
    box-sizing: border-box;
}

/* Page Shell */
.page-shell {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    gap: 0.75rem;
}

.back-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--primary-color);
}

.page-header {
    margin-bottom: 1rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    letter-spacing: -0.025em;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* Main Container - Full Width */
.main-container {
    width: 100%;
}

/* Controls Panel - Full Width */
.controls.full-width {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Info Box - Compact */
.info-box {
    background: linear-gradient(
        135deg,
        rgba(232, 245, 233, 0.9) 0%,
        rgba(174, 213, 129, 0.3) 100%
    );
    border: 1px solid rgba(84, 140, 38, 0.2);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.info-box p {
    margin: 0;
    color: var(--text-main);
}

.info-box strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(84, 140, 38, 0.05);
}

.tab-btn.active {
    color: var(--primary-color);
    background: rgba(84, 140, 38, 0.1);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Page Section */
.page-section {
    margin-bottom: 1.5rem;
}

.page-section-header {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.fields-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}

/* Field Items - Larger for better input */
.field-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.field-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

.required-marker {
    color: #dc2626;
}

.field-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.9);
    transition: all var(--duration-base) var(--ease-smooth);
}

.field-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(84, 140, 38, 0.15);
    background: #ffffff;
}

/* Larger textareas */
textarea.field-input {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

/* Full-width field items for textareas */
.field-item.full-width {
    grid-column: 1 / -1;
}

.field-item.full-width textarea.field-input {
    min-height: 150px;
}

/* Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-smooth);
    text-decoration: none;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(84, 140, 38, 0.2);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(84, 140, 38, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(84, 140, 38, 0.4);
}

.btn-secondary {
    background: rgba(241, 245, 249, 0.8);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(226, 232, 240, 0.9);
    border-color: var(--primary-color);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-full {
    width: 100%;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Field Configuration Panel */
#fieldConfigContainer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.field-config-item {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    transition: all 0.2s;
}

.field-config-item:hover {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.9);
}

.field-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.field-config-label {
    font-weight: 500;
    font-size: 0.9rem;
}

.field-config-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.05);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
}

.field-config-pages {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.page-tag {
    font-size: 0.7rem;
    color: var(--primary-color);
    background: rgba(84, 140, 38, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
}

.field-config-actions {
    display: flex;
    gap: 0.5rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.15s ease;
}

.modal-content {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.modal-content h3 {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Form Group */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-main);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: white;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(84, 140, 38, 0.1);
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    min-width: 320px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.loading-overlay-content h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    color: var(--text-main);
}

.loading-progress-bar {
    width: 100%;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    height: 30px;
    margin: 1.25rem 0;
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.3s ease;
    width: 0%;
}

.loading-progress-text {
    margin: 0.5rem 0 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Universe Container */
#universe-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

#universe-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Utility Classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .page-shell {
        padding: 1rem;
    }

    .fields-wrapper {
        grid-template-columns: 1fr;
    }

    .info-box {
        flex-direction: column;
        gap: 0.5rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }
}

/* ============================================================
   TABLE INPUT COMPONENTS
   ============================================================ */

/* Generic Table Input */
.table-input-wrapper {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 0.5rem;
}

.table-container {
    width: 100%;
    overflow-x: auto;
}

.table-header {
    display: flex;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.table-header-cell {
    flex: 1;
    padding: 0.625rem 0.75rem;
    min-width: 100px;
    text-align: left;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.table-header-cell:last-child {
    border-right: none;
}

.table-rows {
    display: flex;
    flex-direction: column;
}

.table-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.table-row:last-child {
    border-bottom: none;
}

.table-row:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.table-cell {
    flex: 1;
    padding: 0.25rem;
    min-width: 100px;
    border-right: 1px solid var(--border-color);
}

.table-cell:last-child {
    border-right: none;
}

.table-cell-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: transparent;
    transition: all 0.2s ease;
}

.table-cell-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 2px rgba(84, 140, 38, 0.1);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================================
   PHASE TABLE COMPONENT
   ============================================================ */

.phase-table-wrapper {
    background: rgba(255, 255, 255, 0.98);
}

.phase-header {
    display: flex;
    background: #3a3a3a;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    overflow: hidden;
}

.phase-header-cell {
    padding: 0.5rem 0.5rem;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.phase-header-cell:last-child {
    border-right: none;
}

.phases-container {
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    overflow: hidden;
}

.phase-section {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    min-height: 50px;
}

.phase-section:last-child {
    border-bottom: none;
}

.phase-section:nth-child(even) {
    background: #fafafa;
}

.phase-section:nth-child(odd) {
    background: #ffffff;
}

.phase-name {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: #333;
    background: #f5f5f5;
    border-right: 1px solid #e0e0e0;
    text-align: center;
}

.phase-cell {
    display: flex;
    align-items: center;
    padding: 0.25rem;
    border-right: 1px solid #e0e0e0;
}

.phase-cell:last-child {
    border-right: none;
}

.phase-cell-input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    background: transparent;
    transition: all 0.2s ease;
}

.phase-cell-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 2px rgba(84, 140, 38, 0.1);
}

/* ============================================================
   NESTED LIST COMPONENT
   ============================================================ */

.nested-list-wrapper {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    margin-top: 0.5rem;
}

.nested-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nested-list-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.nested-list-marker {
    flex-shrink: 0;
    width: 24px;
    font-weight: 600;
    color: var(--primary-color);
    text-align: right;
    font-size: 0.9rem;
}

.nested-list-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: white;
    transition: all 0.2s ease;
}

.nested-list-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(84, 140, 38, 0.1);
}

.btn-remove-item {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-remove-item:hover {
    background: #dc2626;
    color: white;
}

/* ============================================================
   ARROW INDICATORS (for visual feedback)
   ============================================================ */

.arrow-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 1.2rem;
    margin: 0 0.5rem;
}

.arrow-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.arrow-connector svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}
