/*
 * MartialArtsApp — Main Stylesheet
 *
 * All colours and the font stack are driven by CSS custom properties
 * injected from the PHP theme system (see includes/theme.php).
 * Studio owners can change every colour from the admin dashboard
 * without touching this file.
 */

/* ======================================================
   Reset & Base
   ====================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* ======================================================
   Login Page
   ====================================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--secondary-color);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .35);
}

.login-logo {
    max-height: 80px;
    margin-bottom: 1rem;
}

.login-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: .25rem;
}

.login-tagline {
    font-size: .95rem;
    opacity: .75;
    margin-bottom: 1.75rem;
}

/* ======================================================
   Forms
   ====================================================== */
.login-form,
.branding-form {
    text-align: left;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .3rem;
    color: var(--text-color);
    opacity: .85;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: .65rem .85rem;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    background: rgba(0,0,0,.25);
    color: var(--text-color);
    font-size: .95rem;
    font-family: inherit;
    transition: border-color .2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group input[type="color"] {
    width: 48px;
    height: 36px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    padding: 2px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.color-grid .form-group {
    text-align: center;
}

/* ======================================================
   Buttons
   ====================================================== */
.btn {
    display: inline-block;
    padding: .6rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: opacity .2s, transform .1s;
    font-family: inherit;
}

.btn:hover {
    opacity: .9;
    text-decoration: none;
}

.btn:active {
    transform: scale(.98);
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: .35rem .85rem;
    font-size: .85rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--text-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background: rgba(255,255,255,.08);
}

/* ======================================================
   Alerts
   ====================================================== */
.alert {
    padding: .75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: .9rem;
}

.alert-error {
    background: rgba(244, 67, 54, .15);
    border: 1px solid rgba(244, 67, 54, .4);
    color: #ef9a9a;
}

.alert-success {
    background: rgba(76, 175, 80, .15);
    border: 1px solid rgba(76, 175, 80, .4);
    color: #a5d6a7;
}

/* ======================================================
   Login Footer
   ====================================================== */
.login-footer {
    margin-top: 1.5rem;
    font-size: .85rem;
}

.admin-link {
    opacity: .6;
}
.admin-link:hover {
    opacity: 1;
}

/* ======================================================
   Top Navigation
   ====================================================== */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1.5rem;
    background: var(--secondary-color);
    border-bottom: 2px solid var(--primary-color);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.nav-logo {
    height: 32px;
    width: auto;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-greeting {
    font-size: .9rem;
    opacity: .8;
}

/* ======================================================
   Portal Layout
   ====================================================== */
.portal-main {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1.25rem;
}

/* ======================================================
   Cards
   ====================================================== */
.card {
    background: var(--secondary-color);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.card h3 {
    font-size: 1.05rem;
    margin-top: 1.25rem;
    margin-bottom: .75rem;
    color: var(--accent-color);
}

.section-description {
    font-size: .9rem;
    opacity: .7;
    margin-bottom: 1.25rem;
}

/* ======================================================
   Stats Row
   ====================================================== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    text-align: center;
    padding: 1.25rem 1rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
}

.stat-label {
    font-size: .85rem;
    opacity: .7;
    margin-top: .25rem;
}

/* ======================================================
   Profile Card
   ====================================================== */
.profile-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.profile-field strong {
    opacity: .65;
    font-size: .85rem;
}

.belt-badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: .85rem;
    background: var(--primary-color);
    color: #fff;
}

/* ======================================================
   Data Tables
   ====================================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: .6rem .75rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.data-table th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .55;
}

.data-table tbody tr:hover {
    background: rgba(255,255,255,.03);
}

/* ======================================================
   Status Badges
   ====================================================== */
.status-badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 4px;
    font-size: .8rem;
    font-weight: 600;
}

.status-present {
    background: rgba(76,175,80,.2);
    color: #81c784;
}

.status-absent {
    background: rgba(244,67,54,.2);
    color: #ef9a9a;
}

.status-late {
    background: rgba(255,152,0,.2);
    color: #ffb74d;
}

/* ======================================================
   Announcements
   ====================================================== */
.announcement {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.announcement:last-child {
    border-bottom: none;
}

.announcement h3 {
    margin-top: 0;
}

.announcement-meta {
    font-size: .8rem;
    opacity: .55;
    margin-bottom: .5rem;
}

.empty-state {
    opacity: .5;
    font-style: italic;
}

/* ======================================================
   Footer
   ====================================================== */
.portal-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: .8rem;
    opacity: .4;
}

/* ======================================================
   Registration Page
   ====================================================== */
.register-container {
    max-width: 780px;
}

.password-hint {
    font-size: .8rem;
    opacity: .5;
    margin-bottom: 1.25rem;
    font-style: italic;
}

/* Step Indicator */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.75rem;
}

.step-item {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 700;
    background: rgba(255,255,255,.08);
    color: var(--text-color);
    opacity: .5;
    flex-shrink: 0;
}

.step-circle.active {
    background: var(--primary-color);
    color: #fff;
    opacity: 1;
}

.step-circle.completed {
    background: rgba(76,175,80,.35);
    color: #a5d6a7;
    opacity: 1;
}

.step-label {
    font-size: .8rem;
    font-weight: 600;
    opacity: .5;
}

.step-label.active {
    opacity: 1;
    color: var(--accent-color);
}

.step-connector {
    width: 40px;
    height: 2px;
    background: rgba(255,255,255,.1);
    margin: 0 .5rem;
    flex-shrink: 0;
}

.step-connector.completed {
    background: var(--primary-color);
}

/* Waiver Box */
.waiver-section {
    margin-top: .5rem;
    margin-bottom: 1.25rem;
}

.waiver-section > label:first-child {
    display: block;
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: .5rem;
    color: var(--accent-color);
}

.waiver-box {
    max-height: 200px;
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    background: rgba(0,0,0,.3);
    font-size: .85rem;
    line-height: 1.65;
    white-space: pre-wrap;
    margin-bottom: .75rem;
}

.waiver-box::-webkit-scrollbar {
    width: 6px;
}
.waiver-box::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.15);
    border-radius: 3px;
}

.waiver-agree {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
}

.waiver-agree input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

/* Plan Selection Grid */
.plan-section-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: .25rem;
}

.plan-section-subtitle {
    font-size: .8rem;
    opacity: .6;
    margin-bottom: 1rem;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.plan-card {
    position: relative;
    cursor: pointer;
}

.plan-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.plan-card-inner {
    border: 2px solid rgba(255,255,255,.1);
    border-radius: 8px;
    padding: 1rem;
    transition: border-color .2s, background .2s;
    height: 100%;
}

.plan-card-inner:hover {
    border-color: rgba(255,255,255,.25);
}

.plan-card input[type="radio"]:checked + .plan-card-inner {
    border-color: var(--primary-color);
    background: rgba(255,255,255,.05);
}

.plan-card-name {
    font-weight: 700;
    font-size: .95rem;
    margin-bottom: .25rem;
}

.plan-card-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: .15rem;
}

.plan-card-duration {
    font-size: .8rem;
    opacity: .6;
}

.plan-card-desc {
    font-size: .8rem;
    opacity: .55;
    margin-top: .4rem;
}

.plan-card-skip .plan-card-inner {
    border-style: dashed;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.plan-card-skip .plan-card-name {
    opacity: .7;
}

.plan-card-skip .plan-card-desc {
    opacity: .45;
}

/* School selector cards */
.school-card .plan-card-inner {
    transition: border-color .15s, background .15s;
}
.school-card .plan-card-inner:hover {
    border-color: var(--primary-color);
    background: rgba(255,255,255,.05);
}

/* Payment Summary (Step 2) */
.payment-summary-card {
    background: rgba(0,0,0,.2);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.payment-summary-card h3 {
    font-size: 1rem;
    color: var(--accent-color);
    margin-bottom: .75rem;
}

.payment-row {
    display: flex;
    justify-content: space-between;
    padding: .35rem 0;
    font-size: .9rem;
}

.payment-row.total {
    border-top: 1px solid rgba(255,255,255,.1);
    margin-top: .5rem;
    padding-top: .75rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--accent-color);
}

/* Fee breakdown (renderFeeBreakdownHtml CSS-var variant) */
.fee-breakdown { margin: .25rem 0; }
.fee-breakdown .payment-row { display: flex; justify-content: space-between; padding: .3rem 0; font-size: .9rem; }
.fee-breakdown .text-green { color: #4caf50; font-weight: 600; }
.fee-breakdown .fee-total-row {
    border-top: 1px solid rgba(255,255,255,.12);
    margin-top: .35rem;
    padding-top: .6rem;
}
.fee-breakdown .fee-total-label { font-size: 1rem; font-weight: 700; color: var(--text-color); }
.fee-breakdown .fee-total-value { font-size: 1.15rem; font-weight: 700; color: #4caf50; }

/* Plan card registration fee badge */
.plan-card-regfee {
    font-size: .75rem;
    color: var(--accent-color, #64b5f6);
    margin-top: .15rem;
    opacity: .85;
}

.payment-form-section {
    margin-top: 1.25rem;
}

.stripe-card-element {
    padding: .75rem .85rem;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    background: rgba(0,0,0,.25);
    margin-bottom: .5rem;
}

.card-errors {
    color: #ef9a9a;
    font-size: .85rem;
    min-height: 1.2rem;
    margin-bottom: .75rem;
}

/* Success Page (Step 3) */
.success-icon {
    font-size: 3.5rem;
    margin-bottom: .75rem;
}

.success-message {
    text-align: center;
    padding: 1rem 0;
}

.success-message h2 {
    color: var(--accent-color);
    font-size: 1.4rem;
    margin-bottom: .5rem;
}

.success-message p {
    opacity: .7;
    margin-bottom: 1.5rem;
}

/* Gateway not configured notice */
.gateway-notice {
    background: rgba(255,152,0,.1);
    border: 1px solid rgba(255,152,0,.3);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    font-size: .9rem;
}

.gateway-notice strong {
    color: #ffb74d;
}

.skip-link {
    display: block;
    text-align: center;
    margin-top: 1rem;
    font-size: .85rem;
    opacity: .6;
}

.skip-link:hover {
    opacity: 1;
}

/* ======================================================
   Card Header Row (title + action button side by side)
   ====================================================== */
.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-header-row h2 {
    margin-bottom: 0;
}

/* ======================================================
   Payment Methods
   ====================================================== */
.payment-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.payment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-radius: 8px;
    background: rgba(0,0,0,.15);
}

.payment-info {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.payment-label {
    font-weight: 600;
}

.payment-last4 {
    opacity: .65;
    font-family: monospace;
    letter-spacing: .1em;
}

.payment-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
}

/* ======================================================
   Form Select
   ====================================================== */
.form-select {
    width: 100%;
    padding: .65rem .85rem;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    background: rgba(0,0,0,.25);
    color: var(--text-color);
    font-size: .95rem;
    font-family: inherit;
    transition: border-color .2s;
    appearance: none;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ======================================================
   Danger Button
   ====================================================== */
.btn-danger {
    background: rgba(244, 67, 54, .2);
    color: #ef9a9a;
    border: 1px solid rgba(244, 67, 54, .4);
}

.btn-danger:hover {
    background: rgba(244, 67, 54, .35);
}

/* ======================================================
   Responsive
   ====================================================== */
@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .profile-details {
        grid-template-columns: 1fr;
    }
    .top-nav {
        flex-direction: column;
        gap: .5rem;
        text-align: center;
    }
    .nav-user {
        justify-content: center;
        flex-wrap: wrap;
    }
    .payment-item {
        flex-direction: column;
        align-items: flex-start;
        gap: .5rem;
    }
    .plan-grid {
        grid-template-columns: 1fr;
    }
    .step-label {
        display: none;
    }
    .step-connector {
        width: 24px;
    }
    .register-container {
        max-width: 100%;
    }
}

/* ======================================================
   Mobile Touch Targets (44x44px minimum per Apple HIG)
   ====================================================== */
@media (max-width: 768px) {
    button,
    [role="button"],
    a.btn,
    .sidebar-custom a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .sidebar-custom nav a {
        margin-bottom: 0.25rem;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
}
