/* =================================
   MOBILE-FIRST RESPONSIVE DESIGN
   Universal CSS for All Pages
   ================================= */

/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* MOBILE-FIRST LAYOUT */
.container {
    width: 100%;
    padding: 0;
    margin: 0 auto;
}

/* Add content spacing only where needed */
.content-wrapper {
    padding: 15px;
}

/* TYPOGRAPHY */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 15px;
    color: #2c3e50;
    line-height: 1.2;
}

h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 12px; }

p {
    margin-bottom: 10px;
}

/* LINKS */
a {
    color: #2980b9;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #3498db;
    text-decoration: underline;
}

/* FORMS - MOBILE FIRST */
form {
    margin-bottom: 20px;
}

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

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="datetime-local"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s;
    min-height: 44px;
    background-color: white;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* BUTTONS - MOBILE OPTIMIZED */
button,
.btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
    min-height: 44px;
    width: 100%;
    margin-bottom: 10px;
    font-weight: 500;
}

button:hover,
.btn:hover {
    background-color: #2980b9;
}

button:active,
.btn:active {
    transform: translateY(1px);
}

button.secondary {
    background-color: #95a5a6;
}

button.secondary:hover {
    background-color: #7f8c8d;
}

button.danger {
    background-color: #e74c3c;
}

button.danger:hover {
    background-color: #c0392b;
}

/* NAVIGATION TABS - MOBILE FIRST */
.tabs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 15px;
}

.tab {
    padding: 15px;
    background-color: #dce3ec;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    border: 1px solid #cfd6e1;
    text-align: center;
    font-size: 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab:hover {
    background-color: #c9d6e4;
}

.tab.active {
    background-color: #3498db;
    color: white;
    border-color: #2980b9;
}

/* CONTENT SECTIONS */
.class-section {
    display: none;
    background: #fff;
    padding: 20px 15px;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    border-top: 1px solid #e9ecef;
}

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

/* LISTS */
.student-list {
    list-style: none;
    margin: 10px 0 20px;
    padding: 0;
}

.student-list li {
    margin-bottom: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

ul, ol {
    margin-bottom: 15px;
    padding-left: 20px;
}

/* EXERCISE GROUPS */
.exercise-groups {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 0;
    padding: 15px;
}

.exercise-group,
.group-box {
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 8px;
    background-color: #f9fbfd;
    margin-bottom: 0;
}

.group-box strong {
    font-size: 16px;
    color: #2c3e50;
    display: block;
    margin-bottom: 10px;
}

.group-box ul {
    margin-top: 10px;
}

/* EXERCISE LIST */
.exercise-list {
    margin-top: 20px;
}

.exercise-list h5 {
    margin-bottom: 10px;
    font-size: 16px;
    color: #2c3e50;
}

.exercise-list label {
    display: block;
    margin-bottom: 12px;
    font-size: 16px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #f8f8f8;
    cursor: pointer;
    transition: background-color 0.2s;
}

.exercise-list label:hover {
    background-color: #e8f4f8;
}

.exercise-list label input[type="radio"] {
    transform: scale(1.2);
    margin-right: 10px;
}

.exercise-list .category-block {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #ddd;
}

.exercise-list .buttons {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.exercise-list .buttons button {
    font-size: 16px;
    padding: 12px 20px;
    width: 100%;
    margin: 0;
}

/* TABLES - MOBILE RESPONSIVE */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

th, td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 12px;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* AUTHENTICATION PAGES */
.auth-container {
    background: white;
    padding: 30px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 20px auto;
    max-width: 400px;
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #2c3e50;
    font-size: 20px;
}

.auth-container input {
    margin-bottom: 15px;
}

.auth-container button {
    width: 100%;
    margin-bottom: 15px;
}

.auth-container p {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
}

.auth-container a {
    color: #3498db;
}

/* ERROR & SUCCESS MESSAGES */
.error {
    color: #e74c3c;
    background-color: #fdf2f2;
    border: 1px solid #fcd6d6;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.success {
    color: #27ae60;
    background-color: #f0f9f0;
    border: 1px solid #d4edda;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

/* CARDS */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 15px;
    overflow: hidden;
}

.card-header {
    background: #f8f9fa;
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

.card-body {
    padding: 15px;
}

/* UTILITY CLASSES */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.hidden { display: none; }
.visible { display: block; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }

/* LOADING STATES */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 5px;
}

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

/* QUESTION DISPLAY */
.question {
    font-size: 16px;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

/* RESPONSIVE BREAKPOINTS */

/* TABLET (768px and up) */
@media (min-width: 768px) {
    body {
        padding: 20px;
    }
    
    .container {
        max-width: 750px;
        padding: 0 20px;
    }
    
    .content-wrapper {
        padding: 20px;
    }
    
    h1 { font-size: 28px; }
    h2 { font-size: 24px; }
    h3 { font-size: 20px; }
    
    .tabs {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        margin: 20px 0;
        padding: 20px;
    }
    
    .tab {
        flex: 1;
        min-width: 120px;
        max-width: 200px;
        padding: 10px 20px;
    }
    
    .class-section {
        padding: 25px;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
        margin-bottom: 40px;
        border-top: none;
    }
    
    .exercise-groups {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 20px;
        margin: 20px 0;
        padding: 20px;
    }
    
    .exercise-group,
    .group-box {
        flex: 1;
        min-width: 300px;
    }
    
    .exercise-list .buttons {
        flex-direction: row;
        gap: 15px;
    }
    
    .exercise-list .buttons button {
        width: auto;
        flex: 1;
    }
    
    button,
    .btn {
        width: auto;
        display: inline-block;
        margin-right: 10px;
    }
    
    .form-row {
        display: flex;
        gap: 15px;
    }
    
    .form-row .form-group {
        flex: 1;
    }
    
    table {
        font-size: 15px;
    }
    
    th, td {
        padding: 12px 15px;
    }
    
    .question {
        font-size: 18px;
    }
}

/* DESKTOP (992px and up) */
@media (min-width: 992px) {
    .container {
        max-width: 970px;
    }
    
    h1 { font-size: 32px; }
    h2 { font-size: 28px; }
    h3 { font-size: 24px; }
    
    .class-section {
        padding: 30px;
    }
    
    .exercise-group,
    .group-box {
        min-width: 350px;
    }
    
    .question {
        font-size: 20px;
    }
}

/* LARGE DESKTOP (1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1170px;
    }
    
    .exercise-groups {
        gap: 30px;
    }
    
    .exercise-group,
    .group-box {
        min-width: 400px;
    }
}

/* MOBILE TOUCH IMPROVEMENTS */
@media (max-width: 767px) {
    /* Better touch targets */
    button, .tab, a, input[type="radio"], input[type="checkbox"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Prevent zoom on input focus */
    input, select, textarea {
        font-size: 16px;
    }
    
    /* Better tap highlighting */
    * {
        -webkit-tap-highlight-color: rgba(52, 152, 219, 0.3);
    }
    
    /* Improve scrolling */
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Stack tables on mobile */
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px 4px;
    }
    
    /* Hide less important table columns */
    .hide-mobile {
        display: none;
    }
    
    /* Make all exercise-related elements 12px font for mobile */
    .exercise-list label,
    .exercise-list h5,
    .exercise-group h3,
    .card label,
    .card label[for*="ex"],
    .card label[for*="opt"],
    button,
    .btn,
    .tab {
        font-size: 12px !important;
    }
}

/* ACCESSIBILITY */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* FOCUS INDICATORS */
button:focus,
input:focus,
select:focus,
textarea:focus,
.tab:focus,
a:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* PRINT STYLES */
@media print {
    body {
        background: white;
        font-size: 12pt;
        color: black;
    }
    
    .tabs,
    .exercise-list .buttons,
    button,
    .btn {
        display: none;
    }
    
    .class-section {
        display: block !important;
        page-break-inside: avoid;
        border: 1px solid #000;
        margin-bottom: 20px;
    }
    
    .exercise-list label {
        border: 1px solid #000;
        margin-bottom: 5px;
    }
}

