/* === Reset & Base === */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --crimson: #9B1B30;
    --crimson-dark: #7A1526;
    --crimson-light: #fdf2f4;
    --crimson-border: #f5c6cb;
    --charcoal: #2D2D2D;
    --green-600: #16a34a;
    --green-50: #f0fdf4;
    --red-600: #dc2626;
    --red-50: #fef2f2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 10px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* === GR Top Accent Bar === */
body::before {
    content: '';
    display: block;
    height: 4px;
    background: var(--crimson);
}

/* === Layout === */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 40px 16px 60px;
}

.container {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 40px 36px;
}

/* === Brand header === */
.brand {
    text-align: center;
    margin-bottom: 32px;
}

.brand-icon {
    width: 52px;
    height: 52px;
    background: var(--charcoal);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    font-style: italic;
    letter-spacing: -1px;
    border: 2px solid var(--crimson);
}

.brand h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--charcoal);
    letter-spacing: -0.3px;
}

.brand p {
    font-size: 14px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* === Stepper === */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 32px;
}

.stepper-step {
    display: flex;
    align-items: center;
    gap: 0;
}

.stepper-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid var(--gray-300);
    color: var(--gray-400);
    background: #fff;
    transition: all 0.2s;
    flex-shrink: 0;
}

.stepper-dot.active {
    border-color: var(--crimson);
    background: var(--crimson);
    color: #fff;
}

.stepper-dot.done {
    border-color: var(--green-600);
    background: var(--green-600);
    color: #fff;
}

.stepper-line {
    width: 40px;
    height: 2px;
    background: var(--gray-200);
    margin: 0 4px;
    flex-shrink: 0;
}

.stepper-line.done {
    background: var(--green-600);
}

.stepper-label {
    display: none;
}

/* === Typography === */
h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--charcoal);
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}

h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
}

h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}

p {
    font-size: 15px;
    color: var(--gray-600);
    margin-bottom: 12px;
}

.section-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 6px;
}

.section-desc {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* === Form Elements === */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: 8px;
    font-size: 15px;
    color: var(--gray-800);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder {
    color: var(--gray-400);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--crimson);
    box-shadow: 0 0 0 3px rgba(155,27,48,0.1);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 28px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    line-height: 1.4;
}

.btn-primary {
    background: var(--crimson);
    color: #fff;
}

.btn-primary:hover {
    background: var(--crimson-dark);
    box-shadow: 0 2px 8px rgba(155,27,48,0.25);
}

.btn-small {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    border-radius: 6px;
    background: var(--crimson);
    color: #fff;
    border: none;
    cursor: pointer;
    width: auto;
}

.btn-small:hover {
    background: var(--crimson-dark);
}

.btn-full {
    width: 100%;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 28px;
    background: var(--crimson);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
}

button:hover {
    background: var(--crimson-dark);
    box-shadow: 0 2px 8px rgba(155,27,48,0.25);
}

.btn-google {
    background: #fff;
    color: var(--gray-700);
    border: 1.5px solid var(--gray-300);
    font-weight: 600;
    padding: 12px 28px;
    width: 100%;
    font-size: 15px;
}

.btn-google:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    box-shadow: var(--shadow-sm);
}

.btn-google svg {
    flex-shrink: 0;
}

/* === Alerts === */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.alert-error {
    background: var(--red-50);
    color: var(--red-600);
    border: 1px solid #fecaca;
}

.alert-success {
    background: var(--green-50);
    color: var(--green-600);
    border: 1px solid #bbf7d0;
}

.alert-info {
    background: var(--crimson-light);
    color: var(--crimson);
    border: 1px solid var(--crimson-border);
}

/* Legacy compat */
.error { background: var(--red-50); color: var(--red-600); padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; border: 1px solid #fecaca; }
.success { background: var(--green-50); color: var(--green-600); padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; border: 1px solid #bbf7d0; }

/* === Checkbox / Radio Groups === */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 20px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-weight: normal;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.1s;
    font-size: 15px;
    color: var(--gray-800);
}

.checkbox-group label:hover {
    background: var(--gray-50);
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--crimson);
    flex-shrink: 0;
}

.checkbox-meta {
    font-size: 13px;
    color: var(--gray-400);
    font-weight: normal;
}

/* === Child Section (course picker) === */
.child-section {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.child-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.child-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--crimson);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.child-section .no-courses {
    color: var(--gray-400);
    font-size: 14px;
    font-style: italic;
}

/* === Google connect card === */
.connect-card {
    text-align: center;
    padding: 8px 0;
}

.connect-card .icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--crimson-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.connect-card .icon-circle svg {
    width: 32px;
    height: 32px;
    color: var(--crimson);
}

.connect-info {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 14px 16px;
    margin: 20px 0;
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.6;
}

/* === Done / Success page === */
.done-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--green-50);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border: 2px solid #bbf7d0;
}

.done-icon svg {
    width: 32px;
    height: 32px;
    color: var(--green-600);
}

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

.link-list {
    list-style: none;
    margin: 24px 0;
    padding: 0;
}

.link-list li {
    border-bottom: 1px solid var(--gray-100);
}

.link-list li:last-child {
    border-bottom: none;
}

.link-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    text-decoration: none;
    color: var(--gray-800);
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.1s;
}

.link-list a:hover {
    background: var(--gray-50);
}

.link-list .link-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--crimson-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.link-list .link-icon svg {
    width: 18px;
    height: 18px;
    color: var(--crimson);
}

/* === Dashboard === */
.dashboard-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 16px;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dashboard-header h1 {
    margin-bottom: 0;
}

.user-count {
    font-size: 14px;
    color: var(--gray-500);
    font-weight: normal;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

th, td {
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
}

th {
    background: var(--charcoal);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    border-bottom: 1px solid var(--gray-100);
}

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

tbody tr:hover {
    background: var(--gray-50);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-success {
    background: var(--green-50);
    color: var(--green-600);
}

.status-error {
    background: var(--red-50);
    color: var(--red-600);
}

.status-pending {
    background: var(--gray-100);
    color: var(--gray-500);
}

.links a {
    color: var(--crimson);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    margin-right: 12px;
}

.links a:hover {
    text-decoration: underline;
}

.user-email {
    color: var(--gray-400);
    font-size: 12px;
}

/* === Error Page === */
.error-page {
    text-align: center;
}

.error-page .error-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--red-50);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.error-page .back-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--crimson);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.error-page .back-link:hover {
    text-decoration: underline;
}

/* === Utility === */
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 14px; }
.text-muted { color: var(--gray-500); }

/* === Responsive === */
@media (max-width: 520px) {
    .page-wrapper { padding: 20px 12px 40px; }
    .container { padding: 28px 20px; border-radius: 12px; }
    .stepper-line { width: 24px; }
}
