/* Preferences/Settings Page - Matching Dashboard Styles */

/* Import shared dashboard styles */
@import url('dashboard.css');

/* Override main content padding for settings page */
.main-content {
    padding: 24px 32px;
    background: var(--bg-primary); /* white to match sidebar */
    overflow-y: auto;
    /* Hide scrollbar while keeping scroll functionality */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

.main-content::-webkit-scrollbar { /* Chrome, Safari */
    width: 0;
    height: 0;
}

/* Page Header - Simplified */
/* Remove explicit page header spacing on settings */
.page-header { display: none; }

/* Settings Form Layout */
.settings-form {
    max-width: 1200px;
}

/* Two-column grid for settings cards */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Settings Card */
.settings-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.settings-card:hover {
    box-shadow: var(--shadow-md);
}

.card-header-settings {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.card-header-settings h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Compact Form Groups */
.form-group-compact {
    margin-bottom: 18px;
}

.form-group-compact:last-child {
    margin-bottom: 0;
}

.form-group-compact label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Info Icon (Question Mark) */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
}

.info-icon:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* Tooltip on hover */
.info-icon::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: normal;
    width: max-content;
    max-width: 280px;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Tooltip arrow */
.info-icon::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 1000;
}

/* Show tooltip on hover */
.info-icon:hover::after,
.info-icon:hover::before {
    opacity: 1;
}

.info-icon:hover::after {
    transform: translateX(-50%) translateY(-4px);
}

.info-icon:hover::before {
    transform: translateX(-50%) translateY(-4px);
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: all 0.2s;
}

.form-control:hover {
    border-color: #d1d5db;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    appearance: none;
}

/* Compact Checkbox Grid */
.checkbox-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 4px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 24px;
    transition: all 0.2s;
    cursor: pointer;
}

.checkbox-item:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.checkbox-item input[type="checkbox"]:checked + label {
    color: var(--primary-color);
    font-weight: 600;
}

.checkbox-item label {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    flex: 1;
    user-select: none;
}

/* Pill styling for tags */
.tag-pill {
    padding: 6px 10px;
    border-radius: 16px;
    background: var(--bg-tertiary);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 8px;
}

.btn-primary {
    padding: 12px 28px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 12px 28px;
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-block;
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .main-content {
        padding: 72px 16px 16px 16px;
        background: var(--bg-primary);
    }

    .settings-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .settings-card {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 640px) {
    .page-header h2 { display: none; }

    .settings-card {
        padding: 16px;
    }

    .checkbox-grid-compact {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .card-header-settings {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .form-group-compact {
        margin-bottom: 14px;
    }
}

/* Ensure settings page fits on one page */
@media (min-width: 993px) {
    .settings-form {
        max-height: calc(100vh - 96px);
        display: flex;
        flex-direction: column;
    }

    .settings-grid {
        flex: 1;
        align-items: start;
    }

    .settings-card {
        height: 100%;
    }

    /* Make Topic Filters section scrollable if needed */
    .checkbox-grid-compact {
        max-height: 360px;
        overflow-y: auto;
        padding-right: 8px;
    }

    /* Custom scrollbar for checkbox grid */
    .checkbox-grid-compact::-webkit-scrollbar {
        width: 6px;
    }

    .checkbox-grid-compact::-webkit-scrollbar-track {
        background: var(--bg-secondary);
        border-radius: 3px;
    }

    .checkbox-grid-compact::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 3px;
    }

    .checkbox-grid-compact::-webkit-scrollbar-thumb:hover {
        background: var(--text-light);
    }
}
