/* ============================================================================
   NO-CAP SETTINGS.CSS - ULTRA-KOMPAKT FÜR MOBILE
   Mobile-First, Kein Scrollen, Kompakte Sections, Production Ready
   ============================================================================ */

/* ============================================================================
   USER MENU (TOP RIGHT)
   ============================================================================ */
.user-menu-container {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top, 0) + 0.5rem);
    right: max(1rem, env(safe-area-inset-right, 0) + 0.5rem);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 900;
}

.user-info {
    display: none;
}

.fsk-badges {
    display: flex;
    gap: 0.25rem;
}

.fsk-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.fsk-badge.fsk-0 {
    background: #4caf50;
    color: white;
}

.fsk-badge.fsk-16 {
    background: #ff9800;
    color: white;
}

.fsk-badge.fsk-18 {
    background: #f44336;
    color: white;
}

.settings-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.settings-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* ============================================================================
   SETTINGS MODAL - FULLSCREEN MOBILE
   ============================================================================ */
.settings-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    animation: fadeIn 0.2s ease;
}

.settings-modal-content {
    background: white;
    border-radius: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: none;
    animation: slideUp 0.2s ease;
    overflow: hidden;
}

/* ============================================================================
   SETTINGS HEADER - KOMPAKT
   ============================================================================ */
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    padding-top: max(0.875rem, env(safe-area-inset-top, 0) + 0.875rem);
    border-bottom: 1px solid #e0e0e0;
    background: white;
    flex-shrink: 0;
}

.settings-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
    font-weight: 700;
}

.settings-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f0f0f0;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.settings-close-btn:active {
    background: #e0e0e0;
    transform: scale(0.95);
}

/* ============================================================================
   SETTINGS BODY - GRID LAYOUT FÜR KOMPAKTE DARSTELLUNG
   ============================================================================ */
.settings-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0) + 1rem);
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.875rem;
    align-content: start;
}

.settings-section {
    background: #f8f8f8;
    border-radius: 0.75rem;
    padding: 0.875rem;
}

.settings-section h3 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: #667eea;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.settings-section-icon {
    font-size: 1.1rem;
}

.settings-item {
    margin-bottom: 0.75rem;
}

.settings-item:last-child {
    margin-bottom: 0;
}

.settings-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: #333;
    font-size: 0.85rem;
}

/* ============================================================================
   INPUT FIELDS - KOMPAKT
   ============================================================================ */
.settings-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1.5px solid #e0e0e0;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.2s;
    font-family: inherit;
}

.settings-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group .settings-input {
    flex: 1;
}
.input-group button {
    flex: 0 0 auto;
}
/* ============================================================================
   BUTTONS - KOMPAKT
   ============================================================================ */
.btn-save,
.btn-export,
.btn-primary,
.btn-danger,
.btn-secondary {
    padding: 0.625rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    min-height: 40px;
    font-family: inherit;
    width: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
/* Große Action Buttons sollen weiterhin Full-Width sein */
.btn-export,
.btn-danger,
.btn-secondary {
    width: 100%;
}

.btn-save {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    font-size: 0.78rem;
    padding: 0.5rem 0.75rem;
    min-height: 36px;
}

.btn-save:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.btn-export {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
}

.btn-export:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    font-size: 0.78rem;
    padding: 0.5rem 0.75rem;
    min-height: 36px;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    box-shadow: 0 3px 10px rgba(244, 67, 54, 0.3);
}

.btn-danger:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.2);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:active {
    transform: scale(0.98);
    background: #d0d0d0;
}

/* ============================================================================
   INFO & HINTS - KOMPAKT
   ============================================================================ */
.settings-info {
    color: #666;
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.4;
}

.settings-hint {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.25rem;
    line-height: 1.3;
}

.fsk-status {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

/* ============================================================================
   DANGER ZONE - KOMPAKT
   ============================================================================ */
.settings-danger-zone {
    background: #fff5f5 !important;
    border: 1.5px solid #f44336 !important;
}

.settings-danger-zone h3 {
    color: #f44336;
}

.deletion-info-box {
    background: #fff3cd;
    border: 1.5px solid #ffc107;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.deletion-info-box p {
    margin: 0.375rem 0;
    color: #856404;
    font-size: 0.8rem;
    line-height: 1.4;
}

.deletion-info-box p:first-child {
    margin-top: 0;
}

.deletion-info-box p:last-child {
    margin-bottom: 0;
}

.deletion-info-box strong {
    color: #d32f2f;
    font-weight: 700;
}

#cancel-deletion-container {
    border: 1.5px solid #ffc107;
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: #fffbf0;
}

.settings-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-links a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
    font-size: 0.85rem;
}

.settings-links a:active {
    color: #764ba2;
}

/* ============================================================================
   FSK WARNING MODAL
   ============================================================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal .modal-content {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem 1.25rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.2s ease;
    text-align: center;
}

.modal h2 {
    margin: 0 0 0.875rem 0;
    color: #f44336;
    font-size: 1.2rem;
    font-weight: 700;
}

.modal p {
    margin-bottom: 1.25rem;
    color: #666;
    line-height: 1.5;
    font-size: 0.9rem;
}

.modal-buttons {
    display: flex;
    gap: 0.625rem;
    justify-content: center;
    flex-direction: column;
}

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

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================================================
   LOADING STATE
   ============================================================================ */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    top: 50%;
    left: 50%;
    margin-left: -7px;
    margin-top: -7px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-success {
    background: linear-gradient(135deg, #4caf50, #45a049) !important;
}

.btn-error {
    background: linear-gradient(135deg, #f44336, #d32f2f) !important;
}

/* ============================================================================
   TABLET (640px+) - 2 SPALTEN
   ============================================================================ */
@media (min-width: 640px) {
    .settings-modal {
        padding: 1rem;
    }

    .settings-modal-content {
        border-radius: 1.25rem;
        max-width: 900px;
        max-height: 90vh;
    }

    .settings-header {
        padding: 1rem 1.25rem;
        border-bottom: 2px solid #e0e0e0;
    }

    .settings-header h2 {
        font-size: 1.3rem;
    }

    .settings-close-btn {
        width: 40px;
        height: 40px;
    }

    .settings-body {
        padding: 1.25rem;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .settings-section {
        padding: 0.875rem;
    }

    .settings-section h3 {
        font-size: 0.95rem;
        margin-bottom: 0.625rem;
    }

    .settings-item {
        margin-bottom: 0.625rem;
    }

    .settings-item label {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }

    .settings-input {
        font-size: 0.9rem;
        padding: 0.625rem 0.75rem;
    }

    .btn-save,
    .btn-primary {
        font-size: 0.78rem;
        padding: 0.5rem 0.75rem;
        min-height: 36px;
    }

    .btn-export,
    .btn-danger,
    .btn-secondary {
        font-size: 0.85rem;
        padding: 0.625rem 1rem;
        min-height: 40px;
    }

    .settings-info {
        font-size: 0.8rem;
    }

    .settings-hint {
        font-size: 0.75rem;
    }

    .user-info {
        display: flex;
    }

    .user-display-name {
        font-size: 0.9rem;
        font-weight: 600;
        color: white;
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    /* Full width sections */
    .settings-section.full-width {
        grid-column: 1 / -1;
    }

    /* Deletion Info kompakter */
    .deletion-info-box {
        padding: 0.625rem;
    }

    .deletion-info-box p {
        font-size: 0.75rem;
        margin: 0.25rem 0;
    }

    #cancel-deletion-container {
        padding: 0.625rem;
    }
}

/* ============================================================================
   DESKTOP (1024px+)
   ============================================================================ */
@media (min-width: 1024px) {
    .settings-btn:hover {
        transform: scale(1.05) rotate(15deg);
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    }

    .settings-close-btn:hover {
        background: #e0e0e0;
        transform: rotate(90deg);
    }

    .btn-save:hover,
    .btn-export:hover,
    .btn-primary:hover,
    .btn-danger:hover {
        transform: translateY(-2px);
    }

    .btn-save:hover {
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    }

    .btn-export:hover {
        box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    }

    .btn-danger:hover {
        box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
    }

    .btn-secondary:hover {
        background: #d0d0d0;
    }

    .settings-links a:hover {
        text-decoration: underline;
    }
}

/* ============================================================================
   DARK MODE
   ============================================================================ */
@media (prefers-color-scheme: dark) {
    .settings-modal-content,
    .modal .modal-content {
        background: #1e1e1e;
        color: #fff;
    }

    .settings-header {
        border-bottom-color: #333;
        background: #1e1e1e;
    }

    .settings-header h2,
    .settings-item label {
        color: #fff;
    }

    .settings-section {
        background: #2a2a2a;
    }

    .settings-section h3 {
        color: #8b9cff;
    }

    .settings-input {
        background: #333;
        border-color: #444;
        color: #fff;
    }

    .settings-input:focus {
        border-color: #8b9cff;
        box-shadow: 0 0 0 2px rgba(139, 156, 255, 0.1);
    }

    .settings-close-btn {
        background: #2a2a2a;
        color: #fff;
    }

    .settings-close-btn:active {
        background: #333;
    }

    .user-display-name {
        color: #fff;
    }

    .btn-secondary {
        background: #333;
        color: #fff;
    }

    .btn-secondary:active {
        background: #3a3a3a;
    }

    .settings-info {
        color: #aaa;
    }

    .settings-hint {
        color: #888;
    }

    .modal p {
        color: #aaa;
    }

    .deletion-info-box {
        background: #3a3000;
        border-color: #ffc107;
    }

    .deletion-info-box p {
        color: #ffd54f;
    }

    #cancel-deletion-container {
        background: #2a2200;
    }

    .settings-danger-zone {
        background: #2a1a1a !important;
    }
}

@media (min-width: 1024px) and (prefers-color-scheme: dark) {
    .settings-close-btn:hover {
        background: #333;
    }

    .btn-secondary:hover {
        background: #3a3a3a;
    }
}

/* ============================================================================
   REDUCED MOTION
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
    .settings-modal,
    .modal,
    .settings-modal-content,
    .modal .modal-content {
        animation: none;
    }

    .settings-btn,
    .settings-close-btn,
    .btn-save,
    .btn-export,
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .settings-links a,
    .settings-input {
        transition: none;
    }
}

/* ============================================================================
   HIGH CONTRAST
   ============================================================================ */
@media (prefers-contrast: more) {
    .settings-input,
    .btn-save,
    .btn-export,
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        border: 2px solid white;
    }

    .settings-modal-content,
    .modal .modal-content {
        border: 2px solid white;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */
.hidden {
    display: none !important;
}

.d-flex {
    display: flex !important;
}

.d-block {
    display: block !important;
}

body.modal-open {
    overflow: hidden;
}