/* ============================================================
   SETTINGS PAGE STYLES (Full Page Layout)
   ============================================================ */

#settings-page {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.settings-page-header {
    margin-bottom: 30px;
}

.settings-page-header h2 {
    font-size: 2.2rem;
    color: #333;
    margin: 10px 0;
    font-weight: 700;
}

/* ============================================================
   TAB NAVIGATION
   ============================================================ */

.settings-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.settings-tab {
    flex: 1;
    min-width: 150px;
    padding: 16px 24px;
    background: linear-gradient(180deg, #fafafa 0%, #e9edf3 100%);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.settings-tab:hover {
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fc 100%);
    border-color: #1487c6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(20, 135, 198, 0.2);
}

.settings-tab.active {
    background: linear-gradient(135deg, #1487c6, #18a2ee);
    color: #ffffff;
    border-color: #1487c6;
    box-shadow: 0 4px 12px rgba(20, 135, 198, 0.3);
}

.tab-icon {
    font-size: 1.8rem;
}

.tab-label {
    font-size: 0.95rem;
}

/* ============================================================
   TAB CONTENT
   ============================================================ */

.settings-content-wrapper {
    display: block;
    width: 100%;
}

.settings-tab-content {
    display: none;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.settings-tab-content.active {
    display: block;
    width: 100%;
    box-sizing: border-box;
    animation: fadeIn 0.3s ease-in;
}

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

/* ============================================================
   SETTINGS CARDS
   ============================================================ */

.settings-card {
    background: #ffffff;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s;
}

.settings-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.settings-card-header {
    background: linear-gradient(135deg, #f5f5f5, #e9edf3);
    padding: 18px 24px;
    border-bottom: 2px solid #e0e0e0;
}

.settings-card-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: #333;
    font-weight: 700;
}

.settings-card-body {
    padding: 24px;
}

/* Danger Card Styling */
.danger-card .settings-card-header {
    background: linear-gradient(135deg, #fff5f5, #ffe8e8);
    border-bottom-color: #ffcccc;
}

.danger-card .settings-card-header h3 {
    color: #d32f2f;
}

/* ============================================================
   SETTINGS ITEMS
   ============================================================ */

.settings-item {
    padding: 16px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.settings-item:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

.settings-label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
    font-size: 1rem;
}

.settings-value {
    color: #777;
    font-size: 1rem;
}

.settings-value-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.badge.verified {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.badge.unverified {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* ============================================================
   SWITCH TOGGLE
   ============================================================ */

.switch-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 12px 0;
}

.switch-container:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

.switch-container input[type="checkbox"] {
    display: none;
}

.slider {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
    background-color: #ccc;
    border-radius: 28px;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch-container input[type="checkbox"]:checked + .slider {
    background: linear-gradient(135deg, #40c455, #27945e);
}

.switch-container input[type="checkbox"]:checked + .slider::before {
    transform: translateX(26px);
}

.switch-container input[type="checkbox"]:disabled + .slider {
    background-color: #e0e0e0;
    cursor: not-allowed;
    opacity: 0.6;
}

.switch-label {
    margin-left: 14px;
    font-weight: 500;
    color: #555;
    font-size: 1rem;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
    box-sizing: border-box;
}

.input-field:focus {
    outline: none;
    border-color: #1487c6;
    box-shadow: 0 0 0 3px rgba(20, 135, 198, 0.1);
}

.input-field:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ============================================================
   MESSAGES
   ============================================================ */

.message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    display: none !important;
}

.message.success {
    display: block !important;
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 2px solid #c3e6cb;
}

.message.error {
    display: block !important;
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border: 2px solid #f5c6cb;
}

/* ============================================================
   PLACEHOLDER CONTENT (for coming soon features)
   ============================================================ */

.placeholder-content {
    text-align: center;
    padding: 40px 20px;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.7;
}

.placeholder-text {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 12px;
}

.placeholder-subtext {
    color: #999;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ============================================================
   GEAR BUTTON (in header)
   ============================================================ */

.gear-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.3s;
}

.gear-btn:hover {
    transform: rotate(45deg);
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    #settings-page {
        padding: 16px;
    }

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

    .settings-tabs {
        gap: 8px;
    }

    .settings-tab {
        min-width: 120px;
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .tab-icon {
        font-size: 1.5rem;
    }

    .tab-label {
        font-size: 0.85rem;
    }

    .settings-card-header {
        padding: 14px 18px;
    }

    .settings-card-header h3 {
        font-size: 1.1rem;
    }

    .settings-card-body {
        padding: 18px;
    }

    .settings-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btnunified {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .settings-tabs {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 16px;
    }

    .settings-tab {
        flex-direction: column;
        padding: 10px 8px;
        min-width: unset;
        border-radius: 10px;
        gap: 4px;
    }

    .tab-icon {
        font-size: 1.3rem;
    }

    .tab-label {
        font-size: 0.7rem;
        white-space: nowrap;
    }

    .settings-page-header {
        margin-bottom: 12px;
    }

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

/* ============================================================
   FEEDBACK / SUPPORT TAB STYLES
   ============================================================ */

.feedback-intro {
    color: #666;
    margin-bottom: 24px;
    font-size: 1rem;
    line-height: 1.6;
}

/* Textarea styling */
.input-field.textarea {
    min-height: 150px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

/* Character counter */
.feedback-char-count {
    text-align: right;
    margin-top: 6px;
}

.feedback-char-count span {
    font-size: 0.85rem;
    color: #888;
    transition: color 0.3s;
}

.feedback-char-count span.warning {
    color: #e67e22;
}

.feedback-char-count span.error {
    color: #e74c3c;
    font-weight: 600;
}

/* Screenshot zone */
.feedback-screenshot-zone {
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s;
    background: #fafafa;
}

.feedback-screenshot-zone:hover,
.feedback-screenshot-zone.drag-over {
    border-color: #1487c6;
    background: #f5f9fc;
}

.feedback-screenshot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    color: #888;
}

.feedback-screenshot-placeholder .screenshot-icon {
    width: 48px;
    height: 48px;
    color: #bbb;
}

.feedback-screenshot-placeholder p {
    margin: 0;
    font-size: 0.95rem;
}

.screenshot-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.screenshot-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px !important;
    cursor: pointer;
    font-size: 0.9rem;
}

.screenshot-btn i {
    width: 16px;
    height: 16px;
}

.screenshot-hint {
    font-size: 0.8rem !important;
    color: #aaa !important;
    margin-top: 8px !important;
}

/* Screenshot preview */
.feedback-screenshot-preview {
    position: relative;
    text-align: center;
}

.feedback-screenshot-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.screenshot-clear-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px !important;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.screenshot-clear-btn i {
    width: 14px;
    height: 14px;
}

/* Form hint text */
.form-hint {
    font-size: 0.85rem;
    color: #888;
    margin-top: 6px;
    margin-bottom: 0;
}

/* Feedback message */
.feedback-message {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.feedback-message.success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 2px solid #c3e6cb;
}

.feedback-message.error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.feedback-message.warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border: 2px solid #ffeaa7;
}

.feedback-message.info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border: 2px solid #bee5eb;
}

/* Submit button */
.feedback-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px !important;
    font-size: 1.05rem;
}

.feedback-submit-btn i {
    width: 18px;
    height: 18px;
}

/* Contact options */
.contact-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s;
}

.contact-option:hover {
    background: #f0f4f8;
    transform: translateX(4px);
}

.contact-icon {
    width: 32px;
    height: 32px;
    color: #1487c6;
    flex-shrink: 0;
}

.contact-option strong {
    display: block;
    color: #333;
    margin-bottom: 2px;
}

.contact-option p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

/* Dark mode support */
body.dark-mode .feedback-intro {
    color: #aaa;
}

body.dark-mode .feedback-screenshot-zone {
    background: #2a2a3a;
    border-color: #444;
}

body.dark-mode .feedback-screenshot-zone:hover,
body.dark-mode .feedback-screenshot-zone.drag-over {
    border-color: #1487c6;
    background: #2d3548;
}

body.dark-mode .feedback-screenshot-placeholder {
    color: #999;
}

body.dark-mode .contact-option {
    background: #2a2a3a;
}

body.dark-mode .contact-option:hover {
    background: #333348;
}

body.dark-mode .contact-option strong {
    color: #eee;
}

body.dark-mode .contact-option p {
    color: #aaa;
}

body.dark-mode .form-hint {
    color: #888;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .feedback-screenshot-zone {
        padding: 18px;
    }

    .screenshot-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .screenshot-btn {
        width: auto;
    }

    .feedback-submit-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   PUBLIC PROFILE PAGE STYLES (December 2025)
   ============================================================ */

#profile-page {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

.profile-page-header {
    margin-bottom: 20px;
}

/* Stat items for profile page */
.stat-item {
    padding: 15px 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

body.dark-mode .stat-item {
    background: rgba(30, 41, 59, 0.6);
}

.stat-value {
    font-size: 1.2em;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.85em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tier badges */
.tier-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.tier-bronze { background: #cd7f32; color: white; }
.tier-silver { background: #c0c0c0; color: #333; }
.tier-gold { background: #ffd700; color: #333; }
.tier-platinum { background: #e5e4e2; color: #333; }
.tier-diamond { background: #b9f2ff; color: #333; }
.tier-master { background: linear-gradient(135deg, #667eea, #764ba2); color: white; }

/* Character count for bio */
.char-count {
    text-align: right;
    font-size: 0.85em;
    color: #999;
    margin-top: 5px;
}

/* Fix form fields in modals - ensure they don't overflow */
.modal-card .form-group,
.modal-backdrop .form-group,
#delete-account-modal .form-group {
    margin-bottom: 15px;
}

.modal-card .input-field,
.modal-backdrop .input-field,
#delete-account-modal .input-field {
    width: 100%;
    box-sizing: border-box;
}

/* Feedback form - add right padding to match left */
#support-tab .settings-card-body {
    padding-right: 20px;
}

/* Ensure form groups in settings cards have proper spacing */
.settings-card-body .form-group {
    max-width: 100%;
}

.settings-card-body .input-field,
.settings-card-body .textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* Profile info rows for public profile display */
.profile-info-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

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

.profile-info-label {
    font-weight: 600;
    color: #555;
    min-width: 100px;
    margin-right: 10px;
}

/* Responsive profile form rows */
@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr !important;
    }
}

/* Profile page mobile responsive */
@media (max-width: 600px) {
    #profile-page {
        padding: 12px 8px;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    #profile-page .profile-container {
        max-width: 100% !important;
        padding: 12px 8px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    #profile-page .stat-item {
        padding: 12px 8px;
    }

    #profile-page .stat-value {
        font-size: 1.2em;
    }

    #profile-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    #profile-stats .stat-item:last-child {
        grid-column: span 2;
    }
}

/* ============================================================
   MY STATS - HERO SUMMARY
   ============================================================ */

.stats-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 14px;
    margin-bottom: 16px;
    color: white;
}

.stats-hero-note {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 0.7em;
    opacity: 0.65;
    font-style: italic;
}

.stats-hero-ring {
    position: relative;
    width: 110px;
    height: 110px;
    flex-shrink: 0;
}

.win-ring {
    width: 110px;
    height: 110px;
    transform: rotate(-90deg);
}

.win-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 10;
}

.win-ring-fill {
    fill: none;
    stroke: #2ecc71;
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 326.73;
    transition: stroke-dashoffset 1s ease-out;
}

.win-ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.win-ring-pct {
    font-size: 1.5em;
    font-weight: 800;
    line-height: 1;
}

.win-ring-sub {
    font-size: 0.7em;
    opacity: 0.85;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}



.stats-hero-numbers {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.stats-hero-stat {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.stats-hero-value {
    font-size: 1.6em;
    font-weight: 800;
    line-height: 1;
}

.stats-hero-label {
    font-size: 0.85em;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   MY STATS - DETAIL ROWS
   ============================================================ */

.stats-details {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.stats-detail-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}

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

.stats-detail-icon {
    width: 20px;
    height: 20px;
    color: #888;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.stats-detail-icon svg {
    width: 18px;
    height: 18px;
}

.stats-detail-label {
    flex: 1;
    font-size: 0.9em;
    color: #666;
}

.stats-detail-value {
    font-weight: 700;
    font-size: 0.95em;
    color: #222;
}

/* ============================================================
   MY STATS - COMPACT MODE ROWS
   ============================================================ */

.mode-category {
    margin-bottom: 20px;
}

.mode-category:last-child {
    margin-bottom: 0;
}

.mode-category-header {
    font-size: 0.8em;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-left: 2px;
}

.mode-rows {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px 32px auto;
    gap: 6px;
}

.mode-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: subgrid;
    align-items: center;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-left: 4px solid #ccc;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.mode-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Category accent colors (matched to landing page cards) */
.mode-row-sp { border-left-color: #30a46c; }
.mode-row-mp { border-left-color: #1487c6; }
.mode-row-elimination { border-left-color: #e74c3c; }
.mode-row-daily { border-left-color: #f39c12; }
.mode-row-versus { border-left-color: #9d60ff; }
.mode-row-faceoff { border-left-color: #ef4444; }
.mode-row-timeattack { border-left-color: #1abc9c; }

.mode-row-name {
    font-weight: 600;
    font-size: 0.9em;
    color: #333;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mode-row-badge {
    text-align: left;
    min-width: 0;
}

.mode-row-donut {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 32px;
    height: 28px;
}

.mini-donut {
    display: block;
}

[data-theme="dark"] .mini-donut circle:first-child,
body.dark-mode .mini-donut circle:first-child {
    stroke: #333;
}

.mode-row-nums {
    display: flex;
    gap: 12px;
    font-size: 0.8em;
    color: #888;
    white-space: nowrap;
    justify-self: end;
}

.mode-row-nums strong {
    color: #333;
    font-weight: 700;
}

/* Tier badges */
.tier-badge {
    font-size: 0.7em;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    line-height: 1.4;
}

.tier-badge.tier-bronze { background: linear-gradient(135deg, #cd7f32, #8b4513); color: white; }
.tier-badge.tier-silver { background: linear-gradient(135deg, #c0c0c0, #808080); color: white; }
.tier-badge.tier-gold { background: linear-gradient(135deg, #ffd700, #daa520); color: #333; }
.tier-badge.tier-platinum { background: linear-gradient(135deg, #e5e4e2, #a8a8a8); color: #333; }
.tier-badge.tier-diamond { background: linear-gradient(135deg, #b9f2ff, #00bfff); color: #333; }
.tier-badge.tier-master { background: linear-gradient(135deg, #9b59b6, #6c3483); color: white; }
.tier-badge.tier-grandmaster { background: linear-gradient(135deg, #e74c3c, #c0392b); color: white; }

/* ============================================================
   MY STATS - DARK MODE
   ============================================================ */

[data-theme="dark"] .stats-details,
body.dark-mode .stats-details {
    background: #1e1e2e;
    border-color: #333;
}

[data-theme="dark"] .stats-detail-row,
body.dark-mode .stats-detail-row {
    border-bottom-color: #2a2a3a;
}

[data-theme="dark"] .stats-detail-label,
body.dark-mode .stats-detail-label {
    color: #aaa;
}

[data-theme="dark"] .stats-detail-value,
body.dark-mode .stats-detail-value {
    color: #eee;
}

[data-theme="dark"] .stats-detail-icon,
body.dark-mode .stats-detail-icon {
    color: #666;
}

[data-theme="dark"] .mode-category-header,
body.dark-mode .mode-category-header {
    color: #777;
}

[data-theme="dark"] .mode-row,
body.dark-mode .mode-row {
    background: #1e1e2e;
    border-top-color: #333;
    border-right-color: #333;
    border-bottom-color: #333;
}

[data-theme="dark"] .mode-row-name,
body.dark-mode .mode-row-name {
    color: #e0e0e0;
}

[data-theme="dark"] .mode-row-nums,
body.dark-mode .mode-row-nums {
    color: #777;
}

[data-theme="dark"] .mode-row-nums strong,
body.dark-mode .mode-row-nums strong {
    color: #ddd;
}

/* ============================================================
   MY STATS - RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
    .stats-hero {
        flex-direction: column;
        text-align: center;
        gap: 16px;
        padding: 20px 16px;
    }

    .stats-hero-numbers {
        flex-direction: row;
        justify-content: center;
        gap: 20px;
    }

    .stats-hero-stat {
        flex-direction: column;
        align-items: center;
        gap: 2px;
    }

    .stats-hero-value {
        font-size: 1.3em;
    }

    .stats-hero-label {
        font-size: 0.75em;
    }

    .mode-rows {
        grid-template-columns: minmax(0, 1fr) auto 32px;
    }

    .mode-row-nums {
        grid-column: 1 / -1;
        gap: 8px;
    }
}

/* ============================================================
   PROFILE PAGE - STAT BOXES (shared with public profile)
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.stat-box {
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 3px 16px rgb(0 0 0 / 48%);
}

.stat-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-box-value {
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 6px;
}

.stat-box-label {
    font-size: 0.85em;
    font-weight: 500;
    opacity: 0.9;
}

.stat-box-blue { background: linear-gradient(135deg, #3498db, #2980b9); color: white; }
.stat-box-green { background: linear-gradient(135deg, #2ecc71, #27ae60); color: white; }
.stat-box-yellow { background: linear-gradient(135deg, #f1c40f, #f39c12); color: #333; }
.stat-box-purple { background: linear-gradient(135deg, #9b59b6, #8e44ad); color: white; }
.stat-box-orange { background: linear-gradient(135deg, #e67e22, #d35400); color: white; }
.stat-box-teal { background: linear-gradient(135deg, #1abc9c, #16a085); color: white; }
.stat-box-red { background: linear-gradient(135deg, #e74c3c, #c0392b); color: white; }

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-box { padding: 15px 10px; }
    .stat-box-value { font-size: 1.4em; }
    .stat-box-label { font-size: 0.75em; }
}

/* ============================================================
   PROFILE PAGE DARK MODE
   ============================================================ */

[data-theme="dark"] #profile-page,
body.dark-mode #profile-page {
    background: #1a1f2e;
    color: #e0e0e0;
}

[data-theme="dark"] #profile-page .profile-header,
body.dark-mode #profile-page .profile-header {
    background: #242b3d;
    border-color: #3d4556;
}

[data-theme="dark"] #profile-page .profile-username,
body.dark-mode #profile-page .profile-username {
    color: #ffffff;
}

[data-theme="dark"] #profile-page .profile-member-since,
body.dark-mode #profile-page .profile-member-since {
    color: #9ca3af;
}

[data-theme="dark"] #profile-page .settings-card,
body.dark-mode #profile-page .settings-card {
    background: #242b3d;
    border-color: #3d4556;
}

[data-theme="dark"] #profile-page .settings-card-header,
body.dark-mode #profile-page .settings-card-header {
    background: #2d3548;
    border-color: #3d4556;
    color: #e0e0e0;
}

[data-theme="dark"] #profile-page .settings-card-header h3,
body.dark-mode #profile-page .settings-card-header h3 {
    color: #e0e0e0;
}

[data-theme="dark"] #profile-page .settings-card-body,
body.dark-mode #profile-page .settings-card-body {
    color: #b8bcc4;
}

[data-theme="dark"] .settings-card p.username-warning,
body.dark-mode .settings-card p.username-warning {
    color: #f0c040 !important;
}

[data-theme="dark"] #profile-page .stat-item,
body.dark-mode #profile-page .stat-item {
    background: linear-gradient(180deg, #1a3d2a 0%, #143325 100%) !important;
    border-color: #40c455 !important;
}

[data-theme="dark"] #profile-page .stat-value,
body.dark-mode #profile-page .stat-value {
    color: #e0e0e0;
}

[data-theme="dark"] #profile-page .stat-label,
body.dark-mode #profile-page .stat-label {
    color: #9ca3af;
}

[data-theme="dark"] #profile-page .profile-info-row,
body.dark-mode #profile-page .profile-info-row {
    border-color: #3d4556;
}

[data-theme="dark"] #profile-page .profile-info-label,
body.dark-mode #profile-page .profile-info-label {
    color: #9ca3af;
}

[data-theme="dark"] #profile-page .profile-info-value,
body.dark-mode #profile-page .profile-info-value {
    color: #e0e0e0;
}

/* ============================================================
   PROFILE SUB-TABS
   ============================================================ */

.profile-subtabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 4px;
    background: #f0f0f0;
    border-radius: 10px;
    width: fit-content;
}

.profile-subtab {
    padding: 10px 24px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-subtab:hover {
    color: #333;
    background: rgba(255, 255, 255, 0.5);
}

.profile-subtab.active {
    background: #fff;
    color: #2563eb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.profile-subtab-content {
    display: none;
}

.profile-subtab-content.active {
    display: block;
}

/* Smaller blue button for header */
.btnunified-sm {
    padding: 8px 16px !important;
    font-size: 0.85rem !important;
}

/* Dark mode for profile sub-tabs */
body.dark-mode .profile-subtabs,
[data-theme="dark"] .profile-subtabs {
    background: #2d3748;
}

body.dark-mode .profile-subtab,
[data-theme="dark"] .profile-subtab {
    color: #a0aec0;
}

body.dark-mode .profile-subtab:hover,
[data-theme="dark"] .profile-subtab:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .profile-subtab.active,
[data-theme="dark"] .profile-subtab.active {
    background: #4a5568;
    color: #63b3ed;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ─── Leximon Editor ──────────────────────────────────────────────── */

/* Tab wrapper with arrows */
#leximon-tab .lx-tabs-wrapper {
    position: relative;
    margin-bottom: 20px;
}
#leximon-tab .lx-tabs-inner {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0;
    margin: 0 48px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}
#leximon-tab .lx-tabs-inner::-webkit-scrollbar { display: none; }

#leximon-tab .lx-scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: var(--bg-secondary, #242b3d);
    border: 2px solid var(--border-color, #374151);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s;
    color: var(--text-primary, #e8eaed);
    font-size: 0.8rem;
}
#leximon-tab .lx-scroll-left { left: -4px; }
#leximon-tab .lx-scroll-right { right: -4px; }
#leximon-tab .lx-scroll-arrow:hover {
    border-color: var(--accent, #1487c6);
    background: rgba(255, 255, 255, 0.05);
}
@media (min-width: 769px) {
    #leximon-tab .lx-scroll-arrow { display: flex; }
}
@media (max-width: 768px) {
    #leximon-tab .lx-scroll-arrow { display: none !important; }
    #leximon-tab .lx-tabs-inner { margin: 0; }
}

/* Rounded pill tabs */
#leximon-tab .category-tab {
    flex-shrink: 0;
    padding: 10px 16px;
    border-radius: 20px;
    border: 2px solid var(--border-color, #374151);
    background: transparent;
    color: var(--text-secondary, #a8aab0);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: inherit;
}
#leximon-tab .category-tab:hover {
    border-color: var(--accent, #1487c6);
    color: var(--text-primary, #e8eaed);
}
#leximon-tab .category-tab.active {
    border-color: var(--accent, #1487c6);
    background: var(--accent, #1487c6);
    color: #fff;
}

#leximon-tab h3 {
    font-size: 0.9rem;
    color: var(--text-secondary, #a8aab0);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#leximon-tab .option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

#leximon-tab .option-card {
    background: var(--bg-secondary, #242b3d);
    border: 2px solid var(--border-color, #374151);
    border-radius: 12px;
    padding: 10px 10px 24px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
}
#leximon-tab .option-card:hover {
    border-color: var(--accent, #1487c6);
    transform: translateY(-2px);
}
#leximon-tab .option-card.selected {
    border-color: var(--brand-green, #34d399);
    background: rgba(52, 211, 153, 0.1);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.2);
}
#leximon-tab .option-card .preview-thumb {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#leximon-tab .option-card .preview-thumb svg {
    width: 56px;
    height: 56px;
}
#leximon-tab .option-card .label {
    font-size: 0.75rem;
    color: var(--text-secondary, #a8aab0);
    font-weight: 500;
}
#leximon-tab .option-card.selected .label {
    color: var(--brand-green, #34d399);
}

#leximon-tab .color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
#leximon-tab .color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 3px solid var(--border-color, #374151);
    cursor: pointer;
    transition: all 0.15s;
}
#leximon-tab .color-swatch:hover {
    transform: scale(1.15);
}
#leximon-tab .color-swatch.selected {
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Flag grid: wider cards so flag images display fully */
#leximon-tab .option-grid.flag-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}
#leximon-tab .option-grid.flag-grid .preview-thumb {
    width: 80px;
    height: 54px;
}
#leximon-tab .option-grid.flag-grid .preview-thumb img {
    width: 80px;
    height: auto;
    border-radius: 4px;
}

@media (max-width: 600px) {
    #leximon-tab .option-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── Profile page: Leximon display ── */

.profile-identity-row {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 20px;
    margin: 0 auto 20px;
}

.profile-leximon-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-leximon {
    width: 200px;
    height: 200px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #ffeaa7;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.profile-leximon svg {
    width: 100%;
    height: 100%;
}

.profile-leximon-name {
    display: block;
    margin-top: 6px;
    font-size: 0.9em;
    font-weight: 600;
    color: #666;
    text-align: center;
}

[data-theme="dark"] .profile-leximon,
body.dark-mode .profile-leximon {
    background: #3a3f4b;
}

[data-theme="dark"] .profile-leximon-name,
body.dark-mode .profile-leximon-name {
    color: #aaa;
}

@media (max-width: 600px) {
    .profile-identity-row {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .profile-leximon {
        width: 150px;
        height: 150px;
    }
}
