/* Transcend Tools - Shared Styles */

:root {
    --transcend-blue: #2c5aa0;
    --transcend-blue-dark: #1e4278;
    --transcend-light: #e8f0f8;
    --metric-green: #27ae60;
    --green-light: #d5f4e6;
    --danger-red: #dc2626;
    --red-light: #fee2e2;
    --warning-amber: #f59e0b;
    --amber-light: #fef3c7;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --bg-primary: #f9fafb;
    --bg-card: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-gutter: #0a1628;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

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

html {
    background-color: #0a1628; /* Overscroll background color */
    background-image:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(44, 90, 160, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(30, 58, 95, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse 100% 80% at 50% 100%, rgba(201, 169, 98, 0.05) 0%, transparent 40%),
        linear-gradient(180deg, #0a1628 0%, #0d1f35 50%, #0a1628 100%);
    min-height: 100vh;
    overflow-y: scroll; /* Prevent horizontal shift when scrollbar appears/disappears */
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent; /* Firefox */
    scrollbar-width: thin; /* Firefox */
}

/* Webkit scrollbar styling (Chrome, Safari, Edge) */
/* Always visible scrollbar for document position awareness */
html::-webkit-scrollbar {
    width: 12px;
    background: rgba(255, 255, 255, 0.08);
}

html::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin: 4px 0;
}

html::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
    min-height: 40px;
}

html::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.45);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

/* ==================== AUTH UI ==================== */
.auth-section {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px; /* Prevents header height shift when auth loads */
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--transcend-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--transcend-blue-dark);
}

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

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

/* ==================== AUTH STATES ==================== */
.loading-state, .auth-required, .access-denied {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--transcend-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.access-denied {
    background: var(--red-light);
    border: 1px solid var(--danger-red);
}

.access-denied h2 {
    color: var(--danger-red);
}

.hidden {
    display: none !important;
}

/* ==================== FOOTER ==================== */
.footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.footer a {
    color: var(--transcend-blue);
    text-decoration: none;
}

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

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--transcend-blue);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* ==================== STANDARD LAYOUTS ==================== */
/* Use .container for consistent page width across all tools */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ==================== STANDARD HEADER ==================== */
/* Main header pattern - use on all tool pages */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 0;
    border-bottom: 2px solid var(--border-color);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-section a {
    display: flex;
    align-items: center;
}

.logo {
    height: 32px;
    width: auto;
}

.logo-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

.logo-subtitle {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
}

.logo-subtitle:hover {
    color: var(--transcend-blue);
}

.logo-subtitle.active {
    color: var(--transcend-blue);
    font-weight: 600;
}

/* Navigation links in header */
.nav-link {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.nav-link:hover {
    color: var(--transcend-blue);
}

.nav-link.active {
    color: var(--transcend-blue);
    font-weight: 600;
}

/* ==================== TOOL SUB-NAVIGATION ==================== */
/* Secondary nav for tools with multiple pages (e.g., DCM) */
/* Should be hidden initially, shown via JS after auth */
.tool-subnav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(to bottom, var(--bg-primary) 0%, transparent 100%);
}

.tool-subnav-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-right: 8px;
}

.tool-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tool-nav-link:hover {
    color: var(--transcend-blue);
    background: var(--transcend-light);
}

.tool-nav-link.active {
    color: var(--transcend-blue);
    background: var(--transcend-light);
    border-color: var(--transcend-blue);
    font-weight: 600;
}

/* Admin-only nav items (shown via JS when user is admin) */
.tool-nav-link.admin-only {
    color: #059669;
}

.tool-nav-link.admin-only:hover {
    background: #d1fae5;
}

.tool-nav-link.admin-only.active {
    color: #059669;
    background: #d1fae5;
    border-color: #059669;
}

.tool-nav-icon {
    font-size: 1rem;
}

/* ==================== STANDARD HERO ==================== */
/* Blue gradient hero banner - use on tool landing pages */
.hero {
    text-align: center;
    padding: 40px 24px;
    border-radius: var(--radius-lg);
    color: white;
    margin-bottom: 32px;
    background: linear-gradient(135deg, var(--transcend-blue) 0%, var(--transcend-blue-dark) 100%);
}

.hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.hero p {
    font-size: 1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 12px;
}

/* ==================== DCM-SPECIFIC ACCESS DENIED ==================== */
.dcm-access-denied {
    text-align: center;
    padding: 60px 20px;
    background: var(--red-light);
    border: 1px solid var(--danger-red);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}

.dcm-access-denied h2 {
    color: var(--danger-red);
}

/* ==================== STANDARD CARD GRID SYSTEM ==================== */
/* Use these classes for consistent card layouts across all pages */

.standard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    padding: 0;
}

/* Standard card - vertical layout (icon on top, content below) */
.standard-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 28px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.standard-card:hover {
    border-color: var(--transcend-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.standard-card__icon {
    width: 48px;
    height: 48px;
    background: var(--transcend-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.standard-card__icon img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.standard-card__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.standard-card__subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.standard-card__description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    flex-grow: 1;
}

.standard-card__meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

/* Standard tags */
.standard-tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-active { background: var(--green-light); color: #166534; }
.tag-strategy { background: var(--amber-light); color: #92400e; }
.tag-research { background: #dbeafe; color: #1e40af; }
.tag-fundraising { background: #dbeafe; color: #1e40af; }
.tag-operations { background: var(--green-light); color: var(--metric-green); }
.tag-analytics { background: #fce7f3; color: #9d174d; }
.tag-new { background: var(--amber-light); color: #92400e; }

/* Page section styling */
.page-section {
    margin-bottom: 48px;
}

.page-section__header {
    margin-bottom: 24px;
}

.page-section__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.page-section__title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* Back link pattern */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--transcend-blue);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

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

/* Page title pattern */
.page-header {
    margin-bottom: 32px;
}

.page-header__title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-header__subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .auth-section {
        width: 100%;
        justify-content: center;
    }

    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .tool-subnav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero h1 {
        font-size: 1.5rem;
    }
}
