/* ========================================
   GLOBAL BASE STYLES
   Shared across entire application
   ======================================== */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    background-color: rgba(114, 169, 173, 1);
    min-height: 100vh;
}

/* ========================================
   GLOBAL HEADER STYLES
   ======================================== */

.header-section {
    height: 200px;
    background: url('../images/index/header.png') center/cover no-repeat;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

.header-overlay {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.1);
}

/* Language Selector and User Icon Container */
.language-selector {
    position: absolute;
    top: 9px;
    left: 15px;
    right: 15px;
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

@media (min-width: 576px) {
    .language-selector {
        left: auto;
        right: calc(50% - 300px + 15px); /* 600px container / 2 */
        justify-content: flex-start;
    }
}

@media (min-width: 768px) {
    .language-selector {
        right: calc(50% - 350px + 15px); /* 700px container / 2 */
    }
}

.language-dropdown {
    background: #4c6d70;
    border: 2px solid #4c6d70;
    border-radius: 8px;
    padding: 3px 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #7fcdcd;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.language-dropdown:hover {
    background: #f0f8f0;
    border-color: #7fcdcd;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.language-dropdown:focus {
    outline: 2px solid rgba(127, 205, 205, 0.5);
    outline-offset: 2px;
}

/* User icon button for all header sections */
.user-icon-button {
    color: white;
    font-size: 1.5rem;
    background: rgba(114, 169, 173, 0.9);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: none;
    outline: none;
}

.user-icon-button:hover {
    background: rgba(114, 169, 173, 1);
    transform: scale(1.05);
    color: white;
}

.user-icon-button:focus {
    outline: 2px solid rgba(114, 169, 173, 0.5);
    outline-offset: 2px;
}

.app-title {
    color: white;
    font-size: 2rem;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.back-button {
    color: white;
    text-decoration: none;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    transition: background 0.3s ease;
    margin-top: 60px;
}

.back-button:hover {
    background: rgba(0, 0, 0, 1);
    text-decoration: none;
    color: white;
}

.page-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 500;
    text-align: center;
}

.page-subtitle {
    text-align: center;
}

/* ========================================
   GLOBAL MESSAGE SYSTEM
   ======================================== */

.messages {
    padding: 0 20px;
    margin-bottom: 1rem;
}

.message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left: 4px solid #28a745;
}

.message-error {
    background: linear-gradient(135deg, #f8d7da 0%, #f1b0b7 100%);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.message-info {
    background: linear-gradient(135deg, #cce7ff 0%, #b3d9ff 100%);
    color: #004085;
    border-left: 4px solid #007bff;
}

.selection-limit-message {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideInDown 0.3s ease-out;
}

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

/* ========================================
   GLOBAL BUTTON STYLES
   ======================================== */

.btn-primary, .submit-button {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    text-decoration: none;
}

.btn-primary:hover:not(:disabled), .submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.btn-primary:disabled, .submit-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    margin-top: 20px;
}

.button-primary {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.button-secondary {
    background: white;
    color: #28a745;
    border: 2px solid #28a745;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    color: inherit;
}

.button-large {
    padding: 15px 40px;
    font-size: 18px;
}

.button-inactive {
    background-color: #e9ecef !important;
    color: #6c757d !important;
    border-color: #e9ecef !important;
    cursor: not-allowed !important;
}

.button-inactive:hover {
    background-color: #e9ecef !important;
    color: #6c757d !important;
    border-color: #e9ecef !important;
}

/* ========================================
   GLOBAL FORM STYLES
   ======================================== */

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #7fcdcd;
    box-shadow: 0 0 0 3px rgba(127, 205, 205, 0.1);
}

.input-group {
    padding: 0 1.25rem 1.25rem;
}

.input-group label {
    display: block;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.input-suffix {
    color: #6c757d;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.help-text {
    color: #6c757d;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: block;
}

.form-actions {
    text-align: center;
}

/* ========================================
   GLOBAL MODAL STYLES
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    margin: 20px;
}

.modal-header h3 {
    color: #28a745;
    margin: 0 0 15px 0;
}

.processing-modal-content {
    text-align: center;
    padding: 40px 30px;
}

.spinner-container {
    margin-bottom: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.processing-modal-content h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 24px;
}

.processing-modal-content p {
    margin: 0;
    color: #6c757d;
    font-size: 16px;
}

/* ========================================
   GLOBAL RESPONSIVE BREAKPOINTS
   ======================================== */

@media (min-width: 576px) {
    .container {
        max-width: 600px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 700px;
    }

    .header-section {
        height: 250px;
    }

    .app-title {
        font-size: 2.5rem;
    }
}

/* Small Mobile Devices (390px-428px) */
@media (max-width: 428px) {
    .header-section {
        height: 160px;
        margin-bottom: 15px;
    }
}

/* Extra Small Mobile Devices (below 390px) */
@media (max-width: 389px) {
    .header-section {
        height: 160px;
        margin-bottom: 15px;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus states for keyboard navigation */
button:focus, input:focus, select:focus, textarea:focus {
    outline: 2px solid #7fcdcd;
    outline-offset: 2px;
}

/* ========================================
   GLOBAL FOOTER STYLES
   ======================================== */

.site-footer {
    background-color: #4c6d70;
    color: rgba(255, 255, 255, 0.8);
    padding: 1rem 0;
    margin-top: 2rem;
}

.site-footer .container {
    min-height: auto;
    background-color: transparent;
}

.site-footer .footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
}

.site-footer .footer-copyright {
    color: rgba(255, 255, 255, 0.7);
}

.site-footer .footer-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.site-footer .footer-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-footer .footer-link:hover {
    color: #fff;
    text-decoration: underline;
}

@media (max-width: 480px) {
    .site-footer .footer-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .site-footer .footer-links {
        gap: 0.75rem;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ========================================
   REDDIT WELCOME POPUP
   ======================================== */

.reddit-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.reddit-popup-overlay.active {
    display: flex;
}

.reddit-popup-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: relative;
    animation: redditPopupSlideIn 0.3s ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes redditPopupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.reddit-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.reddit-popup-close:hover {
    color: #333;
}

.reddit-popup-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #ff4500 0%, #ff6b35 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.reddit-popup-icon i {
    font-size: 36px;
    color: white;
}

.reddit-popup-content h3 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.reddit-popup-content p {
    color: #666;
    font-size: 1rem;
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.reddit-popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.reddit-popup-btn {
    width: 100%;
    background: #FF4500;
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.reddit-popup-btn:hover {
    background: #ff5722;
    box-shadow: 0 4px 15px rgba(255, 69, 0, 0.3);
    text-decoration: none;
    color: white;
    transform: translateY(-1px);
}

.reddit-popup-btn i {
    font-size: 1.2rem;
}

.reddit-popup-guest {
    background: transparent;
    border: none;
    color: #666;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s ease;
}

.reddit-popup-guest:hover {
    color: #333;
    text-decoration: underline;
}

@media (max-width: 480px) {
    .reddit-popup-content {
        padding: 24px 20px;
        margin: 16px;
    }

    .reddit-popup-icon {
        width: 60px;
        height: 60px;
    }

    .reddit-popup-icon i {
        font-size: 30px;
    }

    .reddit-popup-content h3 {
        font-size: 1.25rem;
    }

    .reddit-popup-content p {
        font-size: 0.9rem;
    }
}

/* ========================================
   BETA FEEDBACK BUTTON & POPUP
   ======================================== */

/* Floating Feedback Button */
.feedback-trigger-btn {
    position: fixed;
    bottom: 20px;
    right: 15px; /* Mobile: full width container */
    background: #ffd700;
    color: #1a1a1a;
    border: none;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1000;
}

/* Position button within container bounds at different breakpoints */
@media (min-width: 481px) {
    .feedback-trigger-btn {
        right: calc(50% - 240px + 15px); /* 480px container */
    }
}

@media (min-width: 576px) {
    .feedback-trigger-btn {
        right: calc(50% - 300px + 15px); /* 600px container */
    }
}

@media (min-width: 768px) {
    .feedback-trigger-btn {
        right: calc(50% - 350px + 15px); /* 700px container */
    }
}

.feedback-trigger-btn:hover {
    background: #ffed4a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.feedback-trigger-btn i {
    font-size: 0.95rem;
}

/* Feedback Popup Overlay */
.feedback-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.feedback-popup-overlay.active {
    display: flex;
}

/* Feedback Popup Content */
.feedback-popup-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: feedbackPopupSlideIn 0.3s ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes feedbackPopupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.feedback-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.feedback-popup-close:hover {
    color: #333;
}

.feedback-popup-content h3 {
    color: #333;
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 24px 0;
    text-align: center;
}

/* Feedback Form Elements */
.feedback-question {
    margin-bottom: 24px;
}

.feedback-label {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 10px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.feedback-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feedback-radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.feedback-radio-option:hover {
    border-color: #7fcdcd;
    background: #f8fffe;
}

.feedback-radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: #28a745;
}

.feedback-radio-option input[type="radio"]:checked + .feedback-radio-text {
    color: #28a745;
    font-weight: 600;
}

.feedback-radio-option:has(input:checked) {
    border-color: #28a745;
    background: #f0fff4;
}

.feedback-radio-text {
    font-size: 0.95rem;
    color: #333;
}

.feedback-textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s ease;
}

.feedback-textarea:focus {
    outline: none;
    border-color: #7fcdcd;
}

.feedback-input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.feedback-input:focus {
    outline: none;
    border-color: #7fcdcd;
}

.feedback-submit-btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

/* Feedback Success View */
.feedback-success {
    text-align: center;
    padding: 20px 0;
}

.feedback-success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.feedback-success-icon i {
    font-size: 40px;
    color: white;
}

.feedback-success h4 {
    color: #28a745;
    font-size: 1.5rem;
    margin: 0 0 12px 0;
}

.feedback-success p {
    color: #666;
    font-size: 1rem;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.feedback-done-btn {
    min-width: 120px;
    justify-content: center;
}

/* Contact Permission Question */
.feedback-contact-question {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    display: none;
}

.feedback-contact-question.visible {
    display: block;
}

.feedback-contact-label {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 8px;
    display: block;
}

.feedback-contact-options {
    display: flex;
    gap: 16px;
}

.feedback-contact-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.feedback-contact-option input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #28a745;
}

/* ========================================
   EXIT INTENT MODAL
   ======================================== */

.exit-intent-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10001;
    align-items: center;
    justify-content: center;
}

.exit-intent-overlay.active {
    display: flex;
}

.exit-intent-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    position: relative;
    animation: exitIntentSlideIn 0.3s ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes exitIntentSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.exit-intent-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.exit-intent-close:hover {
    color: #333;
}

.exit-intent-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #7fcdcd 0%, #4c6d70 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.exit-intent-icon i {
    font-size: 28px;
    color: white;
}

.exit-intent-content h3 {
    color: #333;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.exit-intent-content p {
    color: #666;
    font-size: 0.9rem;
    margin: 0 0 20px 0;
}

.exit-intent-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.exit-intent-yes {
    width: 100%;
    justify-content: center;
    padding: 12px 24px;
}

.exit-intent-no {
    background: transparent;
    border: none;
    color: #666;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s ease;
}

.exit-intent-no:hover {
    color: #333;
    text-decoration: underline;
}

@media (max-width: 480px) {
    .exit-intent-content {
        padding: 24px 20px;
        margin: 16px;
    }

    .exit-intent-content h3 {
        font-size: 1.1rem;
    }

    .exit-intent-icon {
        width: 50px;
        height: 50px;
    }

    .exit-intent-icon i {
        font-size: 24px;
    }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .feedback-trigger-btn {
        bottom: 15px;
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .feedback-popup-content {
        padding: 24px 20px;
        margin: 16px;
        max-height: 85vh;
    }

    .feedback-popup-content h3 {
        font-size: 1.25rem;
    }

    .feedback-label {
        font-size: 0.9rem;
    }

    .feedback-radio-option {
        padding: 10px 14px;
    }
}