/* =======================================
   SCTM Public Pages - Mobile-First Refresh
   Cleaner spacing, better touch targets,
   and stronger responsiveness on small screens.
   ======================================= */

:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --secondary: #7c3aed;
    --success: #10b981;
    --danger: #dc2626;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.12);
    --transition: all 0.22s ease;
    --radius: 1rem;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    background: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    margin-top: 0;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(32px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-fade-in { animation: fadeIn 0.8s ease forwards; }
.animate-slide-up { animation: slideUp 0.75s ease forwards; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Layout helpers */
.container {
    width: min(1200px, calc(100% - 1.5rem));
    margin: 0 auto;
}

section {
    padding: clamp(2rem, 5vw, 4rem) 0;
}

section h3 {
    font-size: clamp(1.25rem, 3vw, 2rem);
    text-align: center;
    margin-bottom: clamp(1.25rem, 4vw, 3rem);
}

.grid {
    display: grid;
    gap: 1rem;
}

.card,
.member-card,
.product-card {
    border-radius: var(--radius);
    background: var(--bg-white);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover,
.member-card:hover,
.product-card:hover {
    box-shadow: var(--shadow-lg);
}

.member-card-hover {
    transition: var(--transition);
}

.member-card-hover:hover {
    transform: translateY(-6px);
}

.avatar-ring {
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px rgba(99, 102, 241, 0.25);
}

/* Header */
header {
    transition: var(--transition);
}

header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

@media (max-width: 768px) {
    header .container {
        width: min(100%, calc(100% - 1rem));
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    header h1 {
        font-size: 1.1rem;
    }

    header p {
        font-size: 0.875rem;
    }

    header nav {
        display: none;
    }

    header .flex {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header {
        padding: 0.75rem 0 !important;
    }

    header h1 {
        font-size: 0.95rem;
    }

    header p {
        font-size: 0.75rem;
    }
}

/* Buttons */
a.btn,
button.btn,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.75rem 1.1rem;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    touch-action: manipulation;
}

a.btn:active,
button.btn:active {
    transform: scale(0.98);
}

.btn-sm {
    min-height: 40px;
    padding: 0.55rem 0.9rem;
    font-size: 0.875rem;
}

.btn-lg {
    min-height: 48px;
    padding: 0.95rem 1.5rem;
    font-size: 1rem;
}

@media (max-width: 640px) {
    a.btn,
    button.btn,
    .btn {
        width: 100%;
        white-space: normal;
    }

    .btn-sm,
    .btn-lg {
        width: 100%;
    }
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    min-height: 44px;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-size: 16px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--bg-white);
    color: var(--text-primary);
}

.form-group textarea {
    min-height: 7rem;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

table thead th {
    padding: 1rem;
    text-align: left;
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
    font-weight: 700;
    color: var(--text-primary);
}

table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

table tbody tr:hover {
    background: #f8fafc;
}

@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        font-size: 0.875rem;
    }

    table thead th,
    table tbody td {
        padding: 0.75rem 0.65rem;
    }
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge-primary { background: rgba(37, 99, 235, 0.1); color: var(--primary); }
.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.loading { opacity: 0.65; pointer-events: none; }

.line-clamp-2,
.line-clamp-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 { -webkit-line-clamp: 2; }
.line-clamp-3 { -webkit-line-clamp: 3; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    opacity: 0.55;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 9999;
}

.skip-to-main:focus {
    top: 0;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

footer {
    margin-top: auto;
}

@media (max-width: 480px) {
    footer {
        font-size: 0.875rem;
    }

    .container {
        width: min(100%, calc(100% - 0.75rem));
    }

    section {
        padding: 1.5rem 0;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-light: #0f172a;
        --bg-white: #111827;
        --text-primary: #f3f4f6;
        --text-secondary: #cbd5e1;
        --border: #334155;
    }

    body {
        background: #0b1220;
    }

    table thead th,
    table tbody tr:hover {
        background: #111827;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        background: #0f172a;
        color: var(--text-primary);
    }
}
