@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- Modern Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Nuetral Palette (Slate-like) */
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-surface-subtle: #f1f5f9;

    --color-text-main: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #94a3b8;
    --color-border: #e2e8f0;

    /* Brand Colors */
    --color-primary: #4f46e5;
    /* Indigo 600 */
    --color-primary-hover: #4338ca;
    /* Indigo 700 */
    --color-primary-light: #e0e7ff;
    /* Indigo 100 */

    --color-success: #10b981;
    /* Emerald 500 */
    --color-success-bg: #ecfdf5;

    --color-warning: #f59e0b;
    /* Amber 500 */
    --color-warning-bg: #fffbeb;

    --color-danger: #ef4444;
    /* Red 500 */
    --color-danger-bg: #fef2f2;

    /* Theme Specifics */
    --theme-student-primary: #059669;
    /* Emerald 600 */
    --theme-teacher-primary: #7c3aed;
    /* Violet 600 */

    /* Spacing & Layout */
    --bottom-nav-height: 70px;
    --container-max-width: 1200px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.3);

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Theme overrides */
.theme-student {
    --color-primary: var(--theme-student-primary);
    --color-primary-hover: #047857;
    --color-primary-light: #d1fae5;
    --shadow-glow: 0 0 15px rgba(5, 150, 105, 0.3);
}

.theme-teacher {
    --color-primary: var(--theme-teacher-primary);
    --color-primary-hover: #6d28d9;
    --color-primary-light: #ede9fe;
    --shadow-glow: 0 0 15px rgba(124, 58, 237, 0.3);
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.login {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* --- Layout Components --- */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 24px;
}

.has-bottom-nav {
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
}

/* --- Cards --- */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    margin-bottom: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--color-text-main);
    font-weight: 700;
    margin-bottom: 0.5em;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1em;
    color: var(--color-text-secondary);
}

.muted {
    color: var(--color-text-muted);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    gap: 8px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background-color: var(--color-surface-subtle);
    border-color: var(--color-text-muted);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1.125rem;
}

.btn-success {
    background-color: var(--color-success);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    /* Emerald 600 */
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background-color: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
    /* Red 600 */
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background-color: var(--color-warning);
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
    /* Amber 600 */
}

.btn-info {
    background-color: #0ea5e9;
    /* Sky 500 */
    color: white;
}

.btn-info:hover {
    background-color: #0284c7;
    /* Sky 600 */
}

.btn-ghost {
    background-color: transparent;
    color: var(--color-text-secondary);
}

.btn-ghost:hover {
    background-color: var(--color-surface-subtle);
    color: var(--color-text-main);
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline-primary:hover {
    background: var(--color-primary-light);
}

/* --- Forms --- */
label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--color-text-main);
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
    background: var(--color-surface);
    color: var(--color-text-main);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* --- Header --- */
.header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
}

.header h1 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--color-primary);
}

/* --- Bottom Nav --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px;
    transition: color 0.2s;
}

.nav-item.active,
.nav-item:hover {
    color: var(--color-primary);
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
    transition: transform 0.2s;
}

.nav-item.active .nav-icon {
    transform: translateY(-2px);
}

/* --- Utilities & Grid --- */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.stack-v {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

/* Status badges */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.badge-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

/* --- Login Specifics --- */
.login-card {
    background: var(--color-surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    text-align: center;
    border: 1px solid var(--color-border);
}

.login-logo {
    width: 120px;
    margin-bottom: 24px;
    border-radius: var(--radius-md);
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #3c4043;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    width: 100%;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    gap: 12px;
    margin-top: 24px;
}

.google-btn:hover {
    background: #f8fafc;
    box-shadow: var(--shadow-md);
    border-color: #d1d5db;
}

.google-btn img {
    width: 20px;
    height: 20px;
}

/* --- Tables --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

th {
    text-align: left;
    padding: 12px 16px;
    background: var(--color-surface-subtle);
    color: var(--color-text-secondary);
    font-weight: 600;
    border-bottom: 2px solid var(--color-border);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-main);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--color-surface-subtle);
}

/* Mobile responsive tables (scroll) */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- Utilities --- */
.w-100 {
    width: 100%;
}

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

.d-block {
    display: block;
}

.text-danger {
    color: var(--color-danger);
}

.justify-start {
    justify-content: flex-start;
}

/* --- Availability Page Specifics --- */
.availability-slot {
    padding: 10px;
    margin: 6px 0;
    background: var(--color-surface-subtle);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-sm);
}

.badge-slot {
    display: inline-block;
    padding: 6px 10px;
    margin: 3px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.badge-slot-free {
    background: var(--color-success-bg);
    border-color: var(--color-success);
    color: var(--color-success);
}

.badge-slot-busy {
    background: var(--color-danger-bg);
    border-color: var(--color-danger);
    color: var(--color-danger);
}