/* Word Search Generator - Premium Modern Styles */

:root {
    /* Bootstrap 5.3 theming overrides */
    --bs-primary: #2e7d32;
    --bs-primary-rgb: 46, 125, 50;

    /* Override Bootstrap's default link blue globally */
    --bs-link-color: #2e7d32;
    --bs-link-color-rgb: 46, 125, 50;
    --bs-link-hover-color: #1b5e20;
    --bs-link-hover-color-rgb: 27, 94, 32;

    /* Color Palette */
    --primary: #2e7d32;
    --primary-hover: #1b5e20;
    --secondary: #f97316;
    --secondary-hover: #ea580c;
    --accent: #4caf50;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Neutral Colors */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;

    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);

    /* Radii */
    --radius-sm: 0.5rem;
    --radius-md: 0.8rem;
    --radius-lg: 1.25rem;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Layout */
html { height: 100%; }

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

/* HTMX indicator styles */
.htmx-indicator { display: none; opacity: 0; transition: opacity 0.2s ease-in; }
.htmx-request .htmx-indicator { display: inline-block; opacity: 1; }

/* Container */
.main-container { max-width: 1200px; }

/* Header */
.site-header {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

.site-title {
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Cards */
.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    transition: var(--transition);
}

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

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-active-border-color: var(--primary-hover);
    --bs-btn-disabled-bg: var(--primary);
    --bs-btn-disabled-border-color: var(--primary);
    --bs-btn-focus-shadow-rgb: 46, 125, 50;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-active-border-color: var(--primary-hover);
    --bs-btn-active-color: #fff;
    --bs-btn-focus-shadow-rgb: 46, 125, 50;
    --bs-btn-disabled-color: var(--primary);
    --bs-btn-disabled-border-color: var(--primary);
}

.btn-secondary {
    --bs-btn-bg: var(--secondary);
    --bs-btn-border-color: var(--secondary);
    --bs-btn-hover-bg: var(--secondary-hover);
    --bs-btn-hover-border-color: var(--secondary-hover);
    --bs-btn-active-bg: var(--secondary-hover);
    --bs-btn-active-border-color: var(--secondary-hover);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Forms */
.form-label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.form-control {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.1);
}

.form-range::-webkit-slider-thumb { background: var(--primary); }

/* Bootstrap 5.3 compiles form-check-input:checked with hardcoded #0d6efd — override to green */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.25rem rgba(46, 125, 50, 0.25);
}

/* Slider */
.size-slider-group {
    background: var(--bg-main);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.size-display {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    min-width: 3rem;
}

/* Auth pages */
.auth-container {
    max-width: 420px;
    margin: 0 auto;
}

/* Card variants */
.app-card.border-dashed {
    border-style: dashed;
}

.stats-mini-card {
    padding: 0;
}

/* Icon circle avatar (40×40) */
.icon-circle {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

/* Badge */
.badge-premium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.6rem;
}

/* Results */
.success-card {
    border-left: 6px solid var(--success);
    background: linear-gradient(to right, rgba(16, 185, 129, 0.05), transparent);
}

.download-btn {
    padding: 1.25rem;
    font-size: 1.1rem;
    border-radius: var(--radius-md);
}

/* Pricing */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.bundle-card.featured {
    border: 2px solid var(--primary);
    transform: scale(1.05);
    z-index: 10;
}

.bundle-price { font-size: 3.5rem; }

/* Credits */
.credit-stat-card {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.credit-count { font-size: 4rem; line-height: 1; }

/* Mobile nav toggle */
.nav-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition);
}

.nav-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* Footer */
.footer {
    margin-top: auto;
    background: linear-gradient(180deg, var(--bg-card) 0%, rgba(248, 250, 252, 0.95) 100%);
}

.footer::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.footer-brand {
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.footer-tagline {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-links a {
    color: var(--text-muted);
    position: relative;
    padding-bottom: 2px;
    transition: color 0.2s ease;
}

.footer-links {
    gap: 1.5rem;
}

.footer-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1.5px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.25s ease;
}

.footer-links a:hover { color: var(--text-main); }
.footer-links a:hover::after { width: 100%; }

/* Prevent horizontal scroll */
html, body { overflow-x: hidden; }

/* Responsive — breakpoints align with Bootstrap's md (767.98px) and sm (575.98px) */
@media (max-width: 767.98px) {
    header .d-flex { flex-wrap: wrap; gap: 0.5rem; }
    header .btn:not(.btn-sm) { font-size: 0.9rem; padding: 0.5rem 1rem; }
    header .btn-sm { font-size: 0.85rem; padding: 0.4rem 0.85rem; }
    #words { min-height: 120px; }
    .form-label { font-size: 0.9rem; }
    .btn { min-height: 44px; }
    .app-card { padding: 1.5rem; }
    .d-grid.gap-3 > .btn { width: 100%; margin-bottom: 0.5rem; }
    .main-container { padding: 1rem calc(var(--bs-gutter-x) * 0.5); }
    .bundle-card.featured { transform: none; }
    .site-header .container { position: relative; }
    .admin-stats .h2 { font-size: 1.5rem; }
    .admin-stats .app-card { padding: 1rem; }
    .admin-card-header { padding: 1rem; }
    .admin-card-header h5 { font-size: 0.95rem; }
    .admin-description { font-size: 0.95rem; }

    #auth-nav {
        display: flex;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        padding: 1.5rem;
        flex-direction: column;
        gap: 1rem;
        box-shadow: var(--shadow-lg);
        transform: translateY(-10px);
        opacity: 0;
        pointer-events: none;
        transition: var(--transition);
        z-index: 999;
    }

    #auth-nav.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
    #auth-nav .btn { width: 100%; }
    #auth-nav form { width: 100%; }
}

@media (max-width: 575.98px) {
    header .btn-sm { font-size: 0.8rem; padding: 0.35rem 0.7rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    #results { margin-top: 1rem; }
    .admin-stats .h2 { font-size: 1.25rem; }
    .admin-stats .app-card { padding: 0.75rem; }
}

/* Bulk Results */
.puzzle-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.puzzle-stat__number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.puzzle-stat__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 500;
}

.bulk-download-section .btn-primary {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.manifest-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.manifest-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    gap: 0.5rem;
}

.manifest-item__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.manifest-item__title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manifest-item__meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}