/**
 * Settings Modal Styles
 */

/* Settings Panel - wider than default modal */
.settings-panel {
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    flex-shrink: 0;
    gap: 4px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
    touch-action: pan-x;
}

.settings-tab {
    padding: 12px 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.settings-tab:hover {
    color: rgba(255, 255, 255, 0.8);
}

.settings-tab.active {
    color: #00d4ff;
}

.settings-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #00d4ff, #ff00aa);
    border-radius: 2px 2px 0 0;
}

/* Tab Content */
.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.settings-tab-content {
    display: none;
    padding: 20px;
}

.settings-tab-content.active {
    display: block;
}

/* Settings Sections */
.settings-section {
    margin-bottom: 28px;
}

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

.settings-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 16px 0;
}

.settings-description {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
    margin: 0 0 12px 0;
}

/* Settings Value Display */
.settings-value {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.settings-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.settings-badge.unverified {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

/* Form Hints */
.form-hint {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 6px;
}

/* Button Group */
.btn-group {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn.small {
    padding: 8px 14px;
    font-size: 13px;
}

/* Toggle Switch */
.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

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

.toggle-info {
    flex: 1;
    min-width: 0;
}

.toggle-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
}

.toggle-description {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    margin-left: 16px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* Select Input */
.form-select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-select:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.08);
}

.form-select option {
    background: #1a1a1e;
    color: white;
}

/* Usage Stats */
.usage-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 8px;
}

.usage-stat {
    text-align: center;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.usage-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #00d4ff;
    margin-bottom: 4px;
}

.usage-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Usage Chart */
.usage-chart-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.usage-chart {
    width: 100%;
    height: 160px;
}

.usage-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-color.text {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
}

.legend-color.image {
    background: linear-gradient(135deg, #ff00aa 0%, #cc0088 100%);
}

/* Danger Zone */
.danger-zone {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    padding: 20px;
}

.danger-zone h3 {
    color: #ef4444;
}

.deletion-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.deletion-warning p {
    color: #f59e0b;
    font-size: 14px;
    margin: 0 0 12px 0;
}

.btn.danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn.danger:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

.btn.danger svg {
    flex-shrink: 0;
}

/* Export Button */
.btn.secondary svg {
    flex-shrink: 0;
}

.settings-section .btn.secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .settings-panel {
        max-width: 95vw;
        max-height: 95vh;
        margin: 8px;
    }

    .settings-tabs {
        padding: 0 12px;
    }

    .settings-tab {
        padding: 10px 12px;
        font-size: 12px;
    }

    .settings-tab-content {
        padding: 16px;
    }

    .usage-summary {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .usage-stat {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
    }

    .usage-value {
        font-size: 20px;
        margin-bottom: 0;
    }

    .usage-label {
        text-transform: none;
    }

    .settings-toggle-row {
        flex-wrap: wrap;
        gap: 12px;
    }

    .toggle-switch {
        margin-left: 0;
    }
}

/* Animations */
@keyframes settingsFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-tab-content.active {
    animation: settingsFadeIn 0.2s ease;
}

/* Settings note style */
.settings-note {
    font-size: 0.85rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    margin-top: 0.5rem;
}

/* ============================================================================
   LIFE CONTEXT SECTION
   ============================================================================ */

/* Context Source Cards */
.context-source-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.context-source-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
}

.context-source-card.integration {
    border-left: 3px solid rgba(0, 212, 255, 0.3);
}

.context-source-card.integration.connected {
    border-left-color: #22c55e;
}

.context-source-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.context-source-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.context-source-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0, 212, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00d4ff;
}

.context-source-icon.financial { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.context-source-icon.health { background: rgba(255, 0, 170, 0.1); color: #ff00aa; }
.context-source-icon.social { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }

.context-source-title {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.context-source-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.connection-status .connected {
    color: #22c55e;
}

.connection-status .not-connected {
    color: rgba(255, 255, 255, 0.4);
}

.connection-status .sync-time {
    color: rgba(255, 255, 255, 0.4);
}

/* Integration Actions */
.context-source-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.btn.connect {
    padding: 6px 14px;
    font-size: 12px;
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn.connect:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: rgba(0, 212, 255, 0.4);
}

/* Granularity Section */
.granularity-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.granularity-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Context Usage Stats */
.usage-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.usage-stat-item {
    text-align: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.usage-stat-item .source-name {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
}

.usage-stat-item .stat-value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #00d4ff;
}

.usage-stat-item .stat-label {
    display: block;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 2px;
}

/* Transparency Section */
.transparency-section {
    margin-top: 24px;
    padding: 16px;
    background: rgba(0, 212, 255, 0.03);
    border: 1px solid rgba(0, 212, 255, 0.1);
    border-radius: 12px;
}

.transparency-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: #00d4ff;
    margin: 0 0 8px 0;
}

.transparency-section p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0 0 12px 0;
    line-height: 1.5;
}

/* Coming Soon Badge */
.coming-soon-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    margin-left: 8px;
}

/* No Data State */
.no-data {
    text-align: center;
    padding: 24px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
}

/* Mobile adjustments for Life Context */
@media (max-width: 768px) {
    .context-source-card {
        padding: 14px;
    }

    .context-source-icon {
        width: 32px;
        height: 32px;
    }

    .usage-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
