/* app.css - mobile-first responsive UI styles */
:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --muted: #6b7280;
    --text: #111827;
    --primary: #4338ca;
    --primary-soft: #eef2ff;
    --border: #e5e7eb;
    --danger: #dc2626;
}

* {
    box-sizing: border-box;
}

html {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

.page,
.main-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-dot {
    width: 42px;
    height: 42px;
    background: var(--primary);
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: white;
    font-weight: 700;
}

.brand-text h1 {
    margin: 0;
    font-size: 1.4rem;
}

.brand-text p {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.tab {
    background: #eef2ff;
    border: 1px solid transparent;
    color: var(--primary);
    font-weight: 700;
    padding: 0.75rem 1.1rem;
    border-radius: 999px;
    text-decoration: none;
}

.tab.active {
    background: var(--primary);
    color: white;
}

.hero,
.card,
.hero-card,
.dashboard-card,
.content-card,
.preview-card,
.form-card,
.list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.section-title h2,
.section-title h3,
.card-header-title {
    margin: 0;
}

.section-subtext {
    color: var(--muted);
    margin-top: 0.5rem;
    line-height: 1.6;
}

.action-row,
.tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 0.85rem 1.1rem;
    transition: background 0.2s ease, transform 0.2s ease;
    text-decoration: none;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: var(--primary);
    color: white;
}

.button.secondary {
    background: #f8fafc;
    color: var(--text);
    border: 1px solid var(--border);
}

.button.link {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.button.danger {
    background: var(--danger);
    color: white;
}

.card table {
    margin-top: 1rem;
}

.card label,
label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--muted);
}

.card .grid,
.grid {
    display: grid;
    gap: 1.25rem;
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
    background: white;
    color: var(--text);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.table-responsive {
    overflow-x: auto;
}

.mobile-scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.mobile-scroll-x > .mobile-scroll-content {
    min-width: 720px;
}

.mobile-scroll-x.mobile-scroll-calendar > .mobile-scroll-content {
    min-width: 760px;
}

.mobile-scroll-x.mobile-scroll-preview > .mobile-scroll-content {
    min-width: 320px;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th,
td {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.uniform-photo-preview-card {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 280px;
    min-height: 140px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #f8fafc;
    padding: 12px;
}

.uniform-photo-preview {
    width: 100%;
    height: 100%;
    max-height: 140px;
    object-fit: cover;
    border-radius: 16px;
}

.uniform-photo-placeholder {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    color: var(--muted);
    font-size: 0.95rem;
    text-align: center;
    border-radius: 16px;
    background: #eef2ff;
    padding: 12px;
}

.uniform-photo-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

th {
    background: #f8fafc;
    color: var(--muted);
    font-weight: 700;
}

tbody tr:hover {
    background: #f8f9fb;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 700;
}

.token {
    background: #eef2ff;
    color: var(--primary);
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.82rem;
}

.notice {
    border-left: 4px solid rgba(79, 70, 229, 0.75);
    background: #eef2ff;
    padding: 1rem 1rem 1rem 1.2rem;
    margin-bottom: 1.25rem;
    border-radius: 16px;
    color: #1f2937;
}

.footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
    margin-top: 2rem;
    padding-bottom: 1rem;
}

.schedule-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.schedule-subtab {
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text);
    padding: 0.85rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.schedule-subtab.active {
    background: var(--primary);
    color: white;
    border-color: transparent;
}

.schedule-panel {
    display: none;
}

.schedule-panel.active {
    display: block;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.stat {
    border: 1px solid var(--border);
    border-radius: 1.125rem;
    padding: 1.2rem;
    background: var(--surface);
}

.usage-chart {
    display: grid;
    gap: 0.9rem;
    margin-top: 0.75rem;
}

.usage-row {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 3fr) auto;
    gap: 1rem;
    align-items: center;
}

.usage-label {
    font-weight: 600;
    color: var(--text);
}

.usage-count {
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
}

.usage-bar-wrapper {
    width: 100%;
    height: 0.8rem;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.usage-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #4338ca, #8b5cf6);
    transition: width 0.3s ease;
}

.poster-mode-options,
.poster-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.9rem;
}

.poster-mode-option,
.poster-bg-option {
    border-radius: 1.35rem;
    min-height: 110px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.poster-mode-option {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.poster-mode-option.active {
    background: var(--primary);
    color: white;
    border-color: transparent;
}

.poster-mode-option:hover,
.poster-bg-option:hover {
    transform: translateY(-1px);
}

.poster-bg-option {
    color: white;
    border: 2px solid transparent;
    box-shadow: inset 0 0 0 rgba(255,255,255,0);
}

.poster-bg-option.active {
    border-color: rgba(255,255,255,0.65);
    box-shadow: 0 14px 30px rgba(0,0,0,0.12);
}

.poster-bg-label {
    font-size: 1rem;
    font-weight: 700;
}

.poster-bg-caption {
    font-size: 0.86rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

.poster-preview {
    border-radius: 1.5rem;
    padding: 1.5rem;
    min-height: 360px;
    color: #111827;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%);
    box-shadow: 0 20px 60px rgba(17, 24, 39, 0.08);
}

.poster-preview.poster-style-modern { background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%); color: #111827; }
.poster-preview.poster-style-classic { background: #f8f1e5; color: #2d1f14; border: 1px solid #dec2a8; }
.poster-preview.poster-style-minimal { background: #fafafa; color: #111827; border: 1px solid #d1d5db; }
.poster-preview.poster-style-bold { background: #111827; color: #f8fafc; }
.poster-preview.poster-style-soft { background: linear-gradient(135deg, #f8fafc 0%, #dbeafe 100%); color: #1e293b; }
.poster-preview.poster-style-elegant { background: linear-gradient(135deg, #f5f3ff 0%, #e0e7ff 100%); color: #3730a3; border: 1px solid #c7d2fe; }
.poster-preview.poster-style-retro { background: linear-gradient(135deg, #fde68a 0%, #fbbf24 100%); color: #1f2937; }
.poster-preview.poster-style-dark { background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); color: #f8fafc; }

.poster-preview.poster-bg-sunrise { background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 58%, #22d3ee 100%); }
.poster-preview.poster-bg-ocean { background: linear-gradient(135deg, #082f49 0%, #0e7490 48%, #67e8f9 100%); }
.poster-preview.poster-bg-nature { background: linear-gradient(135deg, #052e16 0%, #166534 42%, #14b8a6 100%); }
.poster-preview.poster-bg-night { background: linear-gradient(135deg, #020617 0%, #0f172a 45%, #4f46e5 100%); }
.poster-preview.poster-bg-sunset { background: linear-gradient(135deg, #3b0764 0%, #7e22ce 42%, #f97316 100%); }
.poster-preview.poster-bg-forest { background: linear-gradient(135deg, #022c22 0%, #064e3b 46%, #22d3ee 100%); }
.poster-preview.poster-bg-sky { background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 48%, #38bdf8 100%); }
.poster-preview.poster-bg-lavender { background: linear-gradient(135deg, #312e81 0%, #5b21b6 52%, #a78bfa 100%); }
.poster-preview.poster-bg-coral { background: linear-gradient(135deg, #4c0519 0%, #9d174d 52%, #fb7185 100%); }
.poster-preview.poster-bg-mint { background: linear-gradient(135deg, #042f2e 0%, #0f766e 48%, #2dd4bf 100%); }
.poster-preview.poster-bg-peach { background: linear-gradient(135deg, #451a03 0%, #9a3412 54%, #fb923c 100%); }
.poster-preview.poster-bg-plum { background: linear-gradient(135deg, #3b0764 0%, #6b21a8 50%, #c084fc 100%); }

.poster-preview .poster-badge { display: inline-flex; align-items: center; padding: 0.5rem 0.9rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700; margin-bottom: 1rem; background: rgba(67, 56, 202, 0.12); color: #4338ca; }
.poster-hero-header { margin-bottom: 1.5rem; }
.poster-hero-tag { text-transform: uppercase; letter-spacing: 0.32em; font-size: 0.78rem; color: rgba(255, 255, 255, 0.82); margin-bottom: 0.75rem; }
.poster-month-title { font-size: 3rem; font-weight: 800; line-height: 1; letter-spacing: -0.04em; color: white; margin-bottom: 1.25rem; }
.poster-preview .poster-title { margin: 0 0 14px; font-size: 2rem; line-height: 1.05; }
.poster-preview .poster-copy { margin: 0 0 24px; max-width: 680px; line-height: 1.7; color: inherit; opacity: 0.92; }
.poster-footer-note { margin-top: 1.75rem; text-transform: uppercase; letter-spacing: 0.32em; font-size: 0.8rem; color: rgba(255, 255, 255, 0.72); }
.poster-page-actions button { min-width: 150px; }
.poster-page-actions .button.primary { border: none; }
.poster-page-actions .button.secondary { background: #ffffff; }
.poster-preview .poster-section { margin-top: 1.25rem; }
.poster-preview .poster-section-heading { font-weight: 700; margin-bottom: 0.75rem; }
.poster-preview ul { list-style: none; padding: 0; margin: 0; display:grid; gap: 0.75rem; }
.poster-preview li { padding: 1rem 1.1rem; border-radius: 1rem; background: rgba(255,255,255,0.75); color: inherit; }
.poster-preview.poster-style-bold li { background: rgba(255,255,255,0.1); }
.poster-preview.poster-style-classic li { background: rgba(255,255,255,0.85); }
.poster-preview.poster-style-minimal li { background: rgba(243,244,246,0.9); }

.poster-preview.poster-mode-events .schedule-section,
.poster-preview.poster-mode-schedule .event-section { display: none; }
.poster-mode-schedule .schedule-section,
.poster-mode-events .event-section { display: block; }

.poster-preview.poster-style-classic .poster-badge { background: rgba(91, 33, 8, 0.12); color: #7c4a2a; }

.poster-bg-sunrise { background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 58%, #22d3ee 100%); }
.poster-bg-ocean { background: linear-gradient(135deg, #082f49 0%, #0e7490 48%, #67e8f9 100%); }
.poster-bg-nature { background: linear-gradient(135deg, #052e16 0%, #166534 42%, #14b8a6 100%); }
.poster-bg-night { background: linear-gradient(135deg, #020617 0%, #0f172a 45%, #4f46e5 100%); }
.poster-bg-sunset { background: linear-gradient(135deg, #3b0764 0%, #7e22ce 42%, #f97316 100%); }
.poster-bg-forest { background: linear-gradient(135deg, #022c22 0%, #064e3b 46%, #22d3ee 100%); }
.poster-bg-sky { background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 48%, #38bdf8 100%); }
.poster-bg-lavender { background: linear-gradient(135deg, #312e81 0%, #5b21b6 52%, #a78bfa 100%); }
.poster-bg-coral { background: linear-gradient(135deg, #4c0519 0%, #9d174d 52%, #fb7185 100%); }
.poster-bg-mint { background: linear-gradient(135deg, #042f2e 0%, #0f766e 48%, #2dd4bf 100%); }
.poster-bg-peach { background: linear-gradient(135deg, #451a03 0%, #9a3412 54%, #fb923c 100%); }
.poster-bg-plum { background: linear-gradient(135deg, #3b0764 0%, #6b21a8 50%, #c084fc 100%); }

.contrast-0 { filter: contrast(0.9); }
.contrast-20 { filter: contrast(1); }
.contrast-40 { filter: contrast(1.1); }
.contrast-60 { filter: contrast(1.2); }
.contrast-80 { filter: contrast(1.35); }
.contrast-100 { filter: contrast(1.5); }

@media (max-width: 1024px) {
    .grid-3,
    .grid-4 { grid-template-columns: 1fr; }

    .action-row,
    .tools,
    .section-title {
        flex-direction: column;
        align-items: stretch;
    }

    .button {
        width: 100%;
    }

    .card,
    .hero,
    .preview-card,
    .form-card,
    .list-card {
        padding: 1.25rem;
    }

    .poster-gallery {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .poster-mode-options {
        justify-content: flex-start;
    }

    .poster-bg-option {
        min-height: 110px;
    }

    table {
        width: 100%;
        min-width: 100%;
    }

    th,
    td {
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .page,
    .main-container {
        padding: 0.85rem 0.85rem 1.5rem;
    }

    .mobile-scroll-x > .mobile-scroll-content {
        min-width: 680px;
    }

    .mobile-scroll-x.mobile-scroll-preview > .mobile-scroll-content {
        min-width: 300px;
    }

    .poster-preview {
        padding: 1.25rem;
    }

    .poster-preview .poster-title {
        font-size: 1.6rem;
    }

    .poster-gallery,
    .poster-mode-options {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .poster-bg-option,
    .poster-mode-option {
        min-height: 96px;
        padding: 0.9rem;
    }

    input,
    select,
    textarea {
        font-size: 0.95rem;
    }

    .poster-preview li {
        padding: 0.85rem 0.9rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand,
    .navbar-nav .nav-link {
        font-size: 0.95rem;
    }

    .topbar,
    .nav,
    .section-title {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar {
        padding: 1rem 0;
    }

    .page,
    .main-container {
        padding: 0.75rem 0.75rem 1.25rem;
    }

    .nav {
        gap: 0.5rem;
        padding-bottom: 0.75rem;
    }

    .hero,
    .card,
    .preview-card,
    .form-card,
    .list-card {
        margin: 1rem 0;
        padding: 1rem;
    }

    .poster-preview {
        padding: 1.2rem;
    }

    .poster-preview .poster-title {
        font-size: 1.45rem;
    }

    .poster-copy {
        font-size: 0.95rem;
    }

    .button {
        padding: 0.85rem 1rem;
    }

    .mobile-scroll-x > .mobile-scroll-content,
    .mobile-scroll-x.mobile-scroll-calendar > .mobile-scroll-content {
        min-width: 620px;
    }

    .mobile-scroll-x.mobile-scroll-preview > .mobile-scroll-content {
        min-width: 280px;
    }
}
