/* ============================================
   GetWellHelp Resources - Theme
   Mirrors v2 design system
   ============================================ */

:root {
    --primary: #1a365d;
    --primary-light: #2d4a7c;
    --primary-dark: #0f2341;
    --secondary: #f97316;
    --secondary-light: #fb923c;
    --secondary-dark: #ea580c;
    --success: #10b981;
    --success-light: #34d399;
    --danger: #ef4444;
    --warning: #f59e0b;
    --white: #ffffff;
    --light: #f8fafc;
    --dark: #0f172a;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--gray-700);
    background: var(--light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--secondary); }

/* ---- Header ---- */
.site-header {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--gray-200);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
}

.logo-sub {
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.85em;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    padding: 0.5rem 0.75rem;
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--gray-100);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-badge {
    font-size: 0.85rem;
    color: var(--gray-600);
    font-weight: 500;
}

.user-badge small {
    color: var(--gray-400);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--gray-600);
    border-radius: 2px;
    transition: var(--transition-fast);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
    color: var(--white);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: var(--white);
}

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

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

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

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
}

.btn-full { width: 100%; }

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* ---- Alerts ---- */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 4px solid;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: var(--success);
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: var(--danger);
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: var(--warning);
}

/* ---- Cards ---- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-header h2, .card-header h3 {
    font-size: 1.15rem;
    color: var(--primary);
    font-weight: 700;
}

.card-body {
    padding: 1.5rem;
}

/* ---- Page Header ---- */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    color: var(--primary);
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--gray-500);
    font-size: 0.95rem;
}

/* ---- Section Badge ---- */
.section-badge {
    display: inline-block;
    background: linear-gradient(135deg, rgba(249,115,22,0.1), rgba(249,115,22,0.05));
    color: var(--secondary-dark);
    padding: 0.35rem 1rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

/* ---- Resource Categories & Cards ---- */
.category-section {
    margin-bottom: 2.5rem;
}

.category-title {
    font-size: 1.35rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.25em;
    background: var(--secondary);
    border-radius: 2px;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.resource-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: all var(--transition-base);
    border: 1px solid var(--gray-200);
}

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

.resource-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.resource-card-desc {
    color: var(--gray-600);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
}

.resource-card-desc.truncated {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-card-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: auto;
}

.visibility-tags {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.75rem;
}

.tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tag-free { background: #dbeafe; color: #1e40af; }
.tag-customer { background: #fef3c7; color: #92400e; }
.tag-admin { background: #ede9fe; color: #5b21b6; }

/* ---- Forms ---- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.35rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-family: inherit;
    font-size: 0.9rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--gray-700);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-check label {
    font-size: 0.9rem;
    color: var(--gray-600);
    cursor: pointer;
}

.form-help {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

/* ---- Tables ---- */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.9rem;
}

thead {
    background: var(--gray-100);
}

th {
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr {
    border-bottom: 1px solid var(--gray-200);
    transition: background var(--transition-fast);
}

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

td .actions {
    display: flex;
    gap: 0.5rem;
}

/* ---- Auth Pages ---- */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 2rem;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.auth-card .logo {
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.auth-card h1 {
    text-align: center;
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.35rem;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
}

.auth-card .form-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    text-align: center;
}

/* ---- Modal ---- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 1.15rem;
    color: var(--primary);
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--gray-700);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    color: var(--gray-600);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-400);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

/* ---- Dashboard Stats ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* ---- Invite Section ---- */
.invite-link-box {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-family: monospace;
    font-size: 0.85rem;
    word-break: break-all;
    color: var(--gray-700);
    margin-top: 0.5rem;
}

/* ---- Footer ---- */
.site-footer {
    background: var(--dark);
    color: var(--gray-400);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

.footer-inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand p {
    font-size: 0.9rem;
    margin-top: 0.75rem;
    line-height: 1.6;
}

.footer-links h4,
.footer-contact h4 {
    color: var(--white);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.footer-links a,
.footer-contact a {
    display: block;
    color: var(--gray-400);
    font-size: 0.9rem;
    padding: 0.2rem 0;
    transition: color var(--transition-fast);
}

.footer-links a:hover,
.footer-contact a:hover {
    color: var(--secondary);
}

.site-footer .logo {
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid var(--gray-800);
    padding-top: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
}

.ssl-badge {
    color: var(--success);
    font-weight: 600;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .menu-toggle { display: flex; }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
        border-top: 1px solid var(--gray-200);
    }

    .main-nav.open { display: flex; }

    .header-inner { flex-wrap: wrap; }

    .user-badge { display: none; }

    .resource-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-header h1 {
        font-size: 1.35rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
