/**
 * SwiftSheet Settings Page Styles
 * Scoped styles for the settings screen only
 * All selectors are specific to settings to avoid conflicts
 * 
 * Layout: Left navigation sidebar + Content area with sections
 */

/* ========================================
   LOGO UPLOAD COMPONENT
   ======================================== */

.logo-upload-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.logo-preview-image {
    max-width: 200px;
    max-height: 80px;
    object-fit: contain;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 8px;
    background: var(--bg-surface, white);
    margin-bottom: 8px;
}

#logo-preview-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
}

.danger-button {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.danger-button:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* ========================================
   MAIN LAYOUT - NAVIGATION + CONTENT
   ======================================== */

.settings-container {
    display: flex;
    gap: 20px;
    height: 100%;
    max-height: calc(100vh - 200px);
}

/* ========================================
   LEFT NAVIGATION SIDEBAR
   ======================================== */

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 200px;
    flex-shrink: 0;
}

.settings-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    min-height: 64px;
    background: var(--glass-bg, rgba(255, 255, 255, 0.7));
    border: 2px solid var(--border-color, rgba(102, 126, 234, 0.2));
    border-radius: 12px;
    color: var(--text-main, #495057);
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.settings-nav-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateX(4px);
}

.settings-nav-btn.active {
    background: #E8D9F5;
    border-color: #D4C5E8;
    color: #6b46a8;
}

.settings-nav-btn .nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.settings-nav-btn .nav-text {
    flex: 1;
}

/* Subscription badge styling to prevent button height growth */
.settings-nav-btn .settings-nav-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 4px;
    height: fit-content;
}

/* ========================================
   CONTENT AREA
   ======================================== */

.settings-content {
    flex: 1;
    overflow-y: scroll; /* Always reserve scrollbar space to prevent width jump */
    padding-right: 10px;
    max-width: 900px; /* Cap width but allow responsive shrinking */
    width: 100%; /* Take full available width up to max */
    scrollbar-gutter: stable both-edges; /* Reserve gutter on both sides for modern browsers */
}

/* ========================================
   SETTINGS SECTIONS
   ======================================== */

.settings-section {
    display: none;
    background: transparent;
    border-radius: 0;
    padding: 24px;
    backdrop-filter: none;
    border: none;
    max-width: 900px;
    width: 100%;
    box-sizing: border-box;
}

.settings-section.active {
    display: block;
}

.settings-section-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.settings-section-header h3 {
    color: var(--text-main, #2c3e50);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.settings-section-header p {
    color: var(--text-secondary, #6c757d);
    font-size: 16px;
    margin: 0;
}

.settings-section-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ========================================
   COMPANY BRANDING FORM STYLES
   ======================================== */

.branding-form {
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
}

.branding-form .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.branding-form .form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.branding-form .form-field.full-width {
    grid-column: 1 / -1;
}

.branding-form label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.branding-form input,
.branding-form textarea {
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.branding-form input:focus,
.branding-form textarea:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.color-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-input-group input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
}

.color-text-input {
    flex: 1;
    font-family: monospace;
    font-size: 14px;
}

.form-help {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

/* ========================================
   STORAGE SETTINGS CONTAINER (MATCHES BRANDING-FORM)
   ======================================== */

.storage-settings-container {
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
}

.storage-settings-container h4 {
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.storage-settings-container > p {
    color: #6c757d;
    margin-bottom: 16px;
}

/* ========================================
   STORAGE OPTIONS (RADIO BUTTONS)
   ======================================== */

.storage-options {
    display: grid;
    gap: 15px;
    max-width: 100%;
    width: 100%;
}

.storage-option {
    position: relative;
    max-width: 100%;
    width: 100%;
}

.storage-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.storage-label {
    display: flex;
    align-items: center;
    padding: 16px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.storage-option input[type="radio"]:checked + .storage-label {
    border-color: #9B6DD4;
    background: #f0f8ff;
}

.storage-label:hover {
    border-color: #9B6DD4;
    transform: translateY(-1px);
}

.storage-icon {
    font-size: 2rem;
    margin-right: 15px;
}

.storage-details h4 {
    margin: 0 0 5px 0;
    color: #2c3e50;
}

.storage-details {
    flex: 1;
    max-width: 100%;
    overflow: hidden;
}

.storage-details p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.setup-required {
    color: #dc3545;
    font-weight: 600;
    font-size: 0.8rem;
    margin-top: 5px;
    display: block;
}

/* Dropbox/OneDrive status containers */
#dropbox-status-container,
#onedrive-status-container {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.setup-status {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.coming-soon {
    text-align: center;
    padding: 30px;
    color: #6c757d;
    font-style: italic;
}

/* Dropbox/OneDrive connection button styles */
.connected-status {
    color: #28a745;
    font-weight: 600;
}

.disconnected-status {
    color: #dc3545;
    font-weight: 600;
}

.connect-btn, .disconnect-btn {
    background: linear-gradient(135deg, #6772e5 0%, #8c7cf0 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 5px;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(103, 114, 229, 0.3);
}

.connect-btn:hover, .disconnect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(103, 114, 229, 0.4);
}

.disconnect-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa726 100%);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.disconnect-btn:hover {
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
}

#dropbox-email, #onedrive-email {
    font-weight: normal;
    color: #666;
}

.settings-actions {
    text-align: center;
    margin-top: 30px;
}

/* ========================================
   SUBSCRIPTION MANAGEMENT STYLES
   ======================================== */

.subscription-info-card {
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
}

.subscription-status {
    margin-bottom: 24px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #E8D9F5;
    color: #6b46a8;
    border: 1px solid #D4C5E8;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
}

.status-icon {
    font-size: 16px;
}

.subscription-details {
    color: #6c757d;
    font-size: 14px;
    margin: 0;
}

.subscription-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subscription-actions .help-text {
    color: #6c757d;
    font-size: 13px;
    margin: 0;
}

/* ========================================
   ABOUT & LEGAL SECTION STYLES
   ======================================== */

.about-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 20px;
}

.about-section {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(6px);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid rgba(155, 109, 212, 0.1);
    transition: all 0.3s ease;
}

.about-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(155, 109, 212, 0.15);
}

.about-section h4 {
    color: #9B6DD4;
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.about-section p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 12px;
}

.about-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(155, 109, 212, 0.1);
}

.about-details p {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.legal-links-grid {
    display: grid;
    gap: 16px;
}

.legal-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(155, 109, 212, 0.05);
    border: 2px solid rgba(155, 109, 212, 0.2);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.legal-link:hover {
    background: rgba(155, 109, 212, 0.1);
    border-color: rgba(155, 109, 212, 0.4);
    transform: translateX(4px);
}

.legal-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.legal-link-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legal-link-content strong {
    color: #9B6DD4;
    font-size: 1.1rem;
}

.legal-link-content small {
    color: #666;
    font-size: 0.9rem;
}

/* ========================================
   FAQ & HELP SECTION STYLES
   ======================================== */

.faq-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 20px;
}

.faq-category {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(6px);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid rgba(155, 109, 212, 0.1);
}

.faq-category h4 {
    color: #9B6DD4;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(155, 109, 212, 0.2);
}

.faq-item {
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(248, 249, 250, 0.5);
    border-radius: 8px;
    transition: all 0.2s ease;
}

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

.faq-item:hover {
    background: rgba(155, 109, 212, 0.05);
}

.faq-item h5 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.05rem;
    font-weight: 600;
}

.faq-item p {
    color: #555;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Large screens - expand content area */
@media (min-width: 1024px) {
    .settings-content {
        max-width: 100%;
    }
    
    .settings-section {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .settings-container {
        flex-direction: column;
        gap: 16px;
    }
    
    .settings-nav {
        flex-direction: row;
        overflow-x: auto;
        min-width: auto;
        padding-bottom: 10px;
    }
    
    .settings-nav-btn {
        flex-shrink: 0;
        min-width: 160px;
    }
    
    .branding-form .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

/* ========================================
   DARK MODE STYLES
   ======================================== */

/* About Section Dark Mode */
[data-theme="dark"] .about-section {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .about-section:hover {
    box-shadow: 0 4px 16px rgba(139, 123, 196, 0.2) !important;
}

[data-theme="dark"] .about-section h4 {
    color: var(--brand-primary) !important;
}

[data-theme="dark"] .about-section p {
    color: var(--text-main) !important;
}

[data-theme="dark"] .about-details {
    border-top-color: var(--border-color) !important;
}

[data-theme="dark"] .about-details p {
    color: var(--text-main) !important;
}

[data-theme="dark"] .about-details p strong {
    color: var(--text-main) !important;
}

/* FAQ Section Dark Mode */
[data-theme="dark"] .faq-category {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .faq-category h4 {
    color: var(--brand-primary) !important;
    border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .faq-item {
    background: var(--bg-surface) !important;
}

[data-theme="dark"] .faq-item:hover {
    background: var(--bg-hover) !important;
}

[data-theme="dark"] .faq-item h5 {
    color: var(--text-main) !important;
}

[data-theme="dark"] .faq-item p {
    color: var(--text-secondary) !important;
}

/* Legal Links Dark Mode */
[data-theme="dark"] .legal-link {
    background: var(--bg-surface) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .legal-link:hover {
    background: var(--bg-hover) !important;
    border-color: var(--brand-primary) !important;
}

[data-theme="dark"] .legal-link-content strong {
    color: var(--brand-primary) !important;
}

[data-theme="dark"] .legal-link-content small {
    color: var(--text-muted) !important;
}
