/* =========================================
   HASSANIYA GPA APP - MASTER CSS (app.css)
   ========================================= */

html, body {
    -webkit-text-size-adjust: 100%; 
    font-family: Arial, sans-serif;
    background-color: #f9f9f9;
    color: #333;
    margin: 0;
    padding: 0;
}

body { text-align: center; }
#category-page { min-height: 100vh; }
body.in-lesson-mode { padding: 0 !important; background: white; }

label, input, button { font-family: inherit; font-size: 16px; vertical-align: middle; }

/* --- INDEX PAGE: STATIC PANELS --- */
.top-floating-panel { position: fixed; top: 0; left: 0; width: 100%; background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 2000; padding: 15px 20px; box-sizing: border-box; box-shadow: 0 4px 15px rgba(0,0,0,0.1); display: flex; justify-content: center; }

/* Transparent wrapper that holds floating rows and solid docks */
.bottom-floating-panel { position: fixed; bottom: 0; left: 0; width: 100%; z-index: 1000; display: flex; flex-direction: column; align-items: center; pointer-events: none; }

.solid-bottom-dock { width: 100%; background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; justify-content: center; padding: 15px 15px calc(env(safe-area-inset-bottom, 15px) + 15px) 15px; box-shadow: 0 -4px 15px rgba(0,0,0,0.1); box-sizing: border-box; pointer-events: auto; }

/* --- STRICT UNIFIED BUTTON SIZING & EXPANSION --- */
.bottom-btn, .btn-review, .action-row button, .four-btn-row button, .nav-row button {
    flex: 1; /* Forces the buttons to stretch evenly across their container */
}

.bottom-btn, .btn-review, .action-row button, .four-btn-row button, .nav-row button, #instructions-btn, #cog-btn {
    height: 48px !important;
    font-size: 1rem !important;
    padding: 0 5px !important;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Fluid Auto-Resizing Text & No Wrapping */
.small-btn { 
    height: 38px !important; 
    font-size: clamp(9px, 2.5vw, 14px) !important; 
    white-space: nowrap !important;
    padding: 0 4px !important;
}

/* Explicitly force white text on action buttons */
.bottom-btn, .action-row button, .four-btn-row button { color: white !important; }
.btn-review { background-color: #9C27B0 !important; color: white !important; }
.btn-review:hover { background-color: #7B1FA2 !important; }

.main-content-wrapper { padding-top: 80px; padding-bottom: 220px; padding-left: 10px; padding-right: 10px; }

.menulist { display: none; }
@keyframes fadeGrid { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.gpa-category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; max-width: 1000px; margin: 0 auto; width: 100%; box-sizing: border-box; animation: fadeGrid 0.3s ease-out forwards; }
.gpa-card { position: relative; background: white; border-radius: 8px; padding: 15px; text-decoration: none; color: #333; box-shadow: 0 2px 5px rgba(0,0,0,0.05); border: 1px solid #eee; transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; text-align: left; }
.gpa-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); background: #fdfdfd; }
.gpa-card-title { font-size: 1.1em; font-weight: bold; margin-bottom: 10px; padding-right: 50px; }
.gpa-progress-container { width: 100%; background-color: #e0e0e0; border-radius: 4px; height: 8px; overflow: hidden; margin-bottom: 8px; }
.gpa-progress-fill { height: 100%; background-color: #2196F3; transition: width 0.3s ease; }
.gpa-card-text { font-size: 0.85em; color: #777; }

.gpa-reset-btn { position: absolute; top: 12px; right: 12px; background: #f44336; color: white; border: none; border-radius: 4px; padding: 4px 8px; font-size: 0.8em; cursor: pointer; z-index: 10; }
.gpa-reset-btn:hover { background: #d32f2f; }
.review-checkbox { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; cursor: pointer; z-index: 10; pointer-events: none; } 

body:not(.edit-review-mode) .review-checkbox { display: none !important; }
body.edit-review-mode .gpa-reset-btn { display: none !important; }
body.edit-review-mode .gpa-card { cursor: pointer; } 

/* --- LESSON PAGES: BOTTOM APP DOCK --- */
.controls-panel { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 600px; z-index: 100; display: flex; flex-direction: column; pointer-events: none; }

#gpa-text-display { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 0 10px 5px 10px; text-shadow: 0 0 5px rgba(255,255,255,0.9), 0 0 10px rgba(255,255,255,0.9), 0 0 20px rgba(255,255,255,1); pointer-events: none; }
#gpa-latin { font-size: 24px !important; color: #333 !important; line-height: 1.2 !important; font-weight: bold !important; }
#gpa-arabic { font-size: 32px !important; color: #000 !important; font-weight: bold !important; line-height: 1.2 !important; font-family: 'DejaVu Sans', 'Noto Naskh Arabic', 'Lateef', 'Scheherazade', sans-serif !important; }

.solid-controls { background: transparent; padding: 5px 15px calc(env(safe-area-inset-bottom, 15px) + 15px) 15px; pointer-events: auto; }

.info-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.title-progress { font-size: 1.15em; font-weight: bold; color: #333; text-align: left; text-shadow: 0 0 5px rgba(255,255,255,0.9), 0 0 10px rgba(255,255,255,1); }
.toggle-container { display: flex; gap: 8px; }
.toggle-sq { width: 36px; height: 36px; border-radius: 8px; border: 2px solid #ccc; background: #f9f9f9; color: #777; font-weight: bold; font-size: 1.1em; cursor: pointer; padding: 0; display: flex; justify-content: center; align-items: center; transition: 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.toggle-sq.active-toggle { background: #2196F3; border-color: #2196F3; color: white; }

.action-row, .four-btn-row, .nav-row { display: flex; gap: 10px; width: 100%; flex-wrap: nowrap; margin: 0; }
.action-row { margin-bottom: 10px !important; } /* Fixes the alignment gap between Review and Lesson modes */

.nav-row button { background: #e0e0e0; color: #333 !important; }
.nav-row button:hover { background: #d0d0d0; }
.nav-row button:disabled { opacity: 0.3; pointer-events: none; box-shadow: none; }

.gpa-container { position: relative; width: 100%; max-width: 600px; margin: 0 auto; display: block; visibility: hidden; line-height: 0; }
.gpa-container img { display: block; width: 100%; height: auto; margin: 0; }

.gpa-overlay { position: absolute; cursor: pointer; box-sizing: border-box; border-radius: 8px; transition: border 0.1s ease, background-color 0.1s ease; }
.gpa-mask { background-color: white; border: 2px solid #ccc; opacity: 1 !important; z-index: 5; }
.gpa-highlight { border: 5px solid #2196F3; background-color: rgba(33, 150, 243, 0.2); z-index: 10; }
.gpa-correct { border: 5px solid #4CAF50; background-color: rgba(76, 175, 80, 0.4); z-index: 10; }
.gpa-incorrect { border: 5px solid #F44336; background-color: rgba(244, 67, 54, 0.4); z-index: 10; }

@media (max-width: 768px) {
    .main-content-wrapper { padding-top: 75px; padding-bottom: 240px; }
    .bottom-btn, .btn-review, .action-row button, .four-btn-row button, .nav-row button { font-size: 0.9rem !important; padding: 0 2px !important; }
    #gpa-text-display { padding: 0 5px 5px 5px; }
    #gpa-latin { font-size: 20px !important; }
    #gpa-arabic { font-size: 26px !important; }
}