/* PROPER MOBILE CSS FIX */

/* Base Reset */
* {
    box-sizing: border-box;
}

/* Root font size for mobile */
html {
    font-size: 14px; /* Smaller base for mobile */
}

/* Body defaults */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    overflow-x: hidden;
    width: 100%;
}

/* Container max-width */
.container,
.modal-content,
.login-container {
    max-width: 100%;
    padding: 15px;
    margin: 0 auto;
}

/* Typography Scale for Mobile */
h1 {
    font-size: 1.5rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.25rem;
    line-height: 1.3;
}

h3 {
    font-size: 1.1rem;
    line-height: 1.4;
}

h4 {
    font-size: 1rem;
    line-height: 1.4;
}

p, li {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Buttons */
button {
    font-size: 0.9rem;
    padding: 10px 20px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    max-width: 100%;
}

/* Complete Button Specific Fix */
.complete-btn,
.section-complete,
[class*="complete"] {
    font-size: 0.75rem !important;
    padding: 5px 10px !important;
    display: inline-block !important;
    margin: 5px !important;
}

/* Modal Fixes */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    z-index: 9999;
}

.modal-content {
    width: 90%;
    max-width: 400px;
    margin: 5% auto;
    padding: 20px;
    border-radius: 15px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Daily Reward Modal Specific */
#dailyRewardModal .modal-content {
    padding: 20px;
}

#dailyRewardModal h1 {
    font-size: 1.2rem;
}

#dailyRewardModal .day-box {
    padding: 10px 5px;
    font-size: 0.7rem;
}

/* Profile Modal Specific */
#profileModal .modal-content {
    padding: 20px;
}

/* Module Content */
.modal-body,
.module-content {
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 15px;
}

.modal-body h3,
.module-content h3 {
    font-size: 1.1rem;
    margin: 15px 0 10px 0;
}

.modal-body p,
.module-content p {
    font-size: 0.9rem;
    margin: 10px 0;
}

/* Accordion Sections */
.accordion-header {
    padding: 15px;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-content {
    padding: 15px;
    font-size: 0.9rem;
}

/* Stats Cards */
.stat-card {
    padding: 10px;
    font-size: 0.9rem;
}

.stat-value {
    font-size: 1.2rem;
}

/* Sidebar */
.sidebar {
    width: 250px;
    max-width: 80%;
    font-size: 0.9rem;
}

/* Header */
.header {
    padding: 10px;
}

.header h1 {
    font-size: 1.2rem;
}

/* Login Screen */
.login-input {
    font-size: 1rem;
    padding: 12px;
    width: 100%;
    margin: 10px 0;
}

.login-btn {
    font-size: 1rem;
    padding: 12px 30px;
    width: 100%;
}

/* Media Queries for Different Devices */

/* Small phones (Galaxy Fold, etc) */
@media screen and (max-width: 360px) {
    html {
        font-size: 12px;
    }
    
    .modal-content {
        width: 95%;
        padding: 15px;
    }
    
    button {
        font-size: 0.85rem;
        padding: 8px 15px;
    }
}

/* iPhone SE, small Android */
@media screen and (max-width: 375px) {
    html {
        font-size: 13px;
    }
}

/* Regular phones */
@media screen and (max-width: 414px) {
    html {
        font-size: 14px;
    }
}

/* Phablets and larger phones */
@media screen and (min-width: 415px) and (max-width: 767px) {
    html {
        font-size: 15px;
    }
}

/* Tablets */
@media screen and (min-width: 768px) {
    html {
        font-size: 16px;
    }
    
    .modal-content {
        width: 70%;
        max-width: 600px;
    }
}

/* Desktop */
@media screen and (min-width: 1024px) {
    html {
        font-size: 16px;
    }
    
    .container {
        max-width: 1200px;
    }
}

/* Fix overflow issues */
.modal-body,
.accordion-content,
.module-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Prevent horizontal scroll */
* {
    max-width: 100%;
}

img {
    height: auto;
    max-width: 100%;
}

/* Z-index hierarchy */
.modal { z-index: 9999; }
.modal-content { z-index: 10000; }
.daily-reward-modal { z-index: 10001; }
.confetti { z-index: 10002; }