/* style.css */
/* Import a modern, friendly font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6c5ce7; /* Soft Indigo */
    --primary-hover: #5b4bc4;
    --bg-color: #f4f6f9; /* Slightly darker grey for better card contrast */
    --card-bg: #ffffff;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --success: #00b894; /* Mint Green */
    --success-bg: #e8f8f5;
    --danger: #ff7675; /* Soft Red */
    --danger-bg: #ffeaea;
}

* { box-sizing: border-box; font-family: 'Poppins', sans-serif; }

body {
    background-color: var(--bg-color); color: var(--text-main);
    margin: 0; padding: 20px; line-height: 1.6;
}

.container { max-width: 1000px; margin: 0 auto; } /* Widened slightly for dashboards */

/* Typography & General Styling */
h1, h2, h3, h4 { margin-top: 0; }
a { text-decoration: none; color: var(--primary); }

/* Forms & Inputs */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; color: var(--text-main); font-size: 14px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
    width: 100%; padding: 12px 15px; border: 1px solid #dfe6e9; border-radius: 8px;
    font-size: 14px; transition: border-color 0.3s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; background: white; box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1); }
input[type="file"] { border: 1px dashed #b2bec3; background: var(--bg-color); padding: 10px; }
.hidden { display: none; }

/* Buttons */
button, .btn {
    background: var(--primary); color: white; border: none; padding: 12px 20px;
    border-radius: 8px; font-weight: 600; cursor: pointer; width: 100%;
    transition: 0.3s; display: inline-block; text-align: center; text-decoration: none; font-size: 15px;
}
button:hover, .btn:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-danger { background: var(--danger); width: auto; padding: 8px 16px; border-radius: 20px; font-size: 14px; }
.btn-danger:hover { background: #e05655; }
.btn-small { width: auto; padding: 6px 15px; font-size: 13px; border-radius: 6px; }

/* Cards & Badges */
.card { background: var(--card-bg); padding: 25px; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.03); margin-bottom: 20px; border: 1px solid #edf2f7; }
.badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-block; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.notification { background: var(--success-bg); color: var(--success); padding: 15px; border-radius: 8px; margin-bottom: 20px; text-align: center; font-weight: 500; border: 1px solid #badbcc; }
.error-msg { background: var(--danger-bg); color: var(--danger); padding: 15px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; border: 1px solid #f5c6cb; text-align: center; }

/* Top Bar Navigation */
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; background: #fff; padding: 15px 25px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.02); border: 1px solid #edf2f7; }
.nav-profile { display: flex; align-items: center; gap: 15px; }
.nav-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; border: 2px solid #dfe6e9; }

/* Authentication Pages */
.auth-wrapper { display: flex; align-items: center; justify-content: center; min-height: 90vh; }
.auth-card { background: var(--card-bg); padding: 40px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); width: 100%; max-width: 450px; border: 1px solid #edf2f7; }
.auth-link { color: var(--primary); font-weight: 600; font-size: 14px; }
.auth-link:hover { text-decoration: underline; }

/* Dashboard Grids */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; margin-bottom: 30px; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-bottom: 30px; }


/* ==============================================================
   📱 MOBILE RESPONSIVENESS (Screens under 768px)
   ============================================================== */
@media (max-width: 768px) {
    body { padding: 10px; }
    .container { margin-top: 10px !important; }

    /* Auth Fixes */
    .auth-wrapper { align-items: flex-start; padding-top: 5vh; min-height: 100vh; padding-left: 10px; padding-right: 10px; }
    .auth-card { padding: 30px 20px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
    .auth-card h2 { font-size: 22px; margin-bottom: 5px; }
    .auth-card p { font-size: 14px; margin-bottom: 20px; }

    /* Top Bar */
    .top-bar { flex-direction: column; align-items: flex-start; gap: 15px; padding: 20px; }
    .top-bar .btn.btn-danger { width: 100%; text-align: center; }
    .top-bar h1 { font-size: 20px !important; }

    /* Typography */
    h2 { font-size: 18px !important; }
    h3 { font-size: 16px !important; }

    /* iOS Input Fix */
    input[type="text"], input[type="email"], input[type="password"], select, textarea { font-size: 16px !important; padding: 12px 15px; }
    .toggle-password { right: 10px; font-size: 16px; }
    button, .btn { padding: 14px; font-size: 15px; }

    /* Force Vertical Stacking */
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .course-grid { grid-template-columns: 1fr; }

    /* List & Accordion Adjustments */
    .accordion-header, .student-header-missing { flex-direction: column; align-items: flex-start !important; gap: 12px; }
    .accordion-header > div:last-child, .student-header-missing > div:last-child { width: 100%; justify-content: space-between; }
    
    .grading-form { flex-direction: column; gap: 15px; }
    .grading-form .form-col-small, .grading-form .form-col-large, .grading-form .form-col-btn { width: 100%; min-width: 100%; }
    .grading-form .form-col-btn { margin-top: 0; }
    
    .text-preview-box { max-height: 200px; padding: 10px; font-size: 13px; }
}

/* ==============================================================
   📱 EXTRA SMALL SCREENS (Phones under 480px)
   ============================================================== */
@media (max-width: 480px) {
    .auth-card { padding: 25px 15px; }
    .stats-grid { grid-template-columns: 1fr; }
    
    .student-info { flex-direction: column; align-items: flex-start; gap: 8px; }
    .student-avatar { width: 40px; height: 40px; }
}