/* ===================================================
   Schedule App — Professional Bootstrap Theme
   iOS + Android cross-platform
   =================================================== */

/* === Safe areas & global === */
:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --app-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --app-accent: #e94560;
    --app-accent-soft: rgba(233, 69, 96, 0.12);
    --app-surface: #ffffff;
    --app-bg: #f0f2f5;
    --app-radius: 16px;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.03);
    --card-shadow-hover: 0 8px 30px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.04);
}

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--app-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100dvh;
}

#app {
    max-width: 540px;
    margin: 0 auto;
    min-height: 100dvh;
    position: relative;
}

/* === Navbar === */
.app-navbar {
    background: var(--app-gradient) !important;
    padding-top: calc(10px + var(--safe-top)) !important;
    padding-bottom: 10px !important;
    box-shadow: 0 4px 20px rgba(26, 26, 46, 0.3);
    border: none;
    z-index: 100;
}

.app-navbar .container-fluid {
    max-width: 540px;
}

.btn-back-nav {
    text-decoration: none !important;
    opacity: 0.9;
    transition: opacity 0.15s, transform 0.15s;
}
.btn-back-nav:active {
    transform: scale(0.9);
    opacity: 1;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
    line-height: 1.3;
}

.header-subtitle {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    line-height: 1.3;
    margin-top: 1px;
}

.min-w-0 { min-width: 0; }

/* === Section titles === */
.section-label {
    font-size: 13px;
    font-weight: 600;
    color: #8b95a5;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    padding-left: 4px;
}

/* === City / Group / Date list cards === */
.select-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.select-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    background: var(--app-surface);
    border: none;
    border-radius: var(--app-radius);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    text-align: left;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}
.select-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(233,69,96,0.04));
    opacity: 0;
    transition: opacity 0.2s;
}
.select-card:hover::after,
.select-card:focus::after {
    opacity: 1;
}
.select-card:active {
    transform: scale(0.98);
    box-shadow: var(--card-shadow);
}

.select-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f0f2f5, #e8ecf1);
    position: relative;
    z-index: 1;
}
.select-icon-wrap.city-icon {
    background: linear-gradient(135deg, #e8f4fd, #d0e8f9);
}
.select-icon-wrap.group-icon {
    background: linear-gradient(135deg, #fce4ec, #f8d7e0);
}
.select-icon-wrap.date-icon {
    background: linear-gradient(135deg, #e8f5e9, #d7ecd9);
}

.select-info {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}
.select-label {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.3;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.select-sub {
    font-size: 12px;
    color: #8b95a5;
    margin-top: 2px;
}

.select-arrow {
    color: #c0c7d0;
    font-size: 18px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    transition: transform 0.2s;
}
.select-card:hover .select-arrow {
    transform: translateX(3px);
    color: var(--app-accent);
}

/* === Schedule cards === */
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 80px;
}

.event-card {
    background: var(--app-surface);
    border-radius: var(--app-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: box-shadow 0.2s;
    border-left: 4px solid transparent;
}

.event-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}
.event-card-header:active {
    background: rgba(0,0,0,0.02);
}

.time-block {
    flex-shrink: 0;
    text-align: center;
    min-width: 54px;
    padding: 6px 0;
    border-radius: 10px;
    background: #f5f7fa;
}
.time-start {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.time-end {
    font-size: 11px;
    color: #8b95a5;
    margin-top: 2px;
    line-height: 1;
}

.event-body {
    flex: 1;
    min-width: 0;
}

.event-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}
.event-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}
.photo-badge {
    font-size: 11px;
    font-weight: 600;
    color: #22c55e;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.event-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.35;
}
.event-route {
    font-size: 12px;
    color: #64748b;
    margin-top: 3px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 4px;
}
.event-route i {
    font-size: 10px;
    color: #94a3b8;
}

.event-chevron {
    flex-shrink: 0;
    color: #c0c7d0;
    font-size: 16px;
    margin-top: 4px;
    transition: transform 0.25s ease;
}
.event-chevron.open {
    transform: rotate(180deg);
    color: var(--app-accent);
}

/* === Card Details (collapsible) === */
.event-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.event-details.open {
    max-height: 2000px;
}

.event-details-inner {
    padding: 0 16px 16px;
    border-top: 1px solid #f0f2f5;
}

.detail-block {
    margin-top: 14px;
}
.detail-label {
    font-size: 11px;
    font-weight: 700;
    color: #8b95a5;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}
.detail-value {
    font-size: 13px;
    color: #334155;
    line-height: 1.55;
}
.detail-card {
    background: #f8f9fb;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    color: #334155;
    line-height: 1.55;
    border: 1px solid #eef0f3;
}

/* Route badges */
.route-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    line-height: 1.4;
}
.route-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.route-dot.start { background: #22c55e; }
.route-dot.end { background: #ef4444; }
.route-connector {
    width: 2px;
    height: 14px;
    background: #dde1e7;
    margin-left: 3px;
}

/* Phones */
.phone-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.phone-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 12px;
    background: #eef3ff;
    border: 1.5px solid #c7d8f8;
    color: #1d4ed8;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s;
}
.phone-chip:hover {
    background: #dce7ff;
    color: #1d4ed8;
}
.phone-chip:active {
    transform: scale(0.97);
}

/* Photo button */
.btn-take-photo {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: 2px dashed #c0c7d0;
    background: #fafbfc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    transition: all 0.2s;
    margin-top: 14px;
}
.btn-take-photo:hover {
    border-color: var(--app-accent);
    color: var(--app-accent);
    background: var(--app-accent-soft);
}
.btn-take-photo:active {
    transform: scale(0.98);
}

/* Photo result */
.photo-result {
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid #22c55e;
    margin-top: 14px;
}
.photo-result img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}
.photo-result-bar {
    padding: 10px 14px;
    background: #f0fdf4;
    font-size: 13px;
    color: #166534;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-retake-sm {
    margin-left: auto;
    background: none;
    border: none;
    color: #ef4444;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* === Empty state === */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}
.empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    display: block;
}
.empty-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}
.empty-text {
    font-size: 14px;
    color: #8b95a5;
    margin-top: 6px;
}

/* === Photo Overlay (Camera) === */
.photo-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: #000;
    display: flex;
    flex-direction: column;
}
.photo-overlay.d-none { display: none !important; }

.photo-header {
    padding-top: calc(8px + var(--safe-top));
    background: rgba(0,0,0,0.85);
    color: #fff;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
}

.photo-viewfinder video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #111;
}

.watermark-preview {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    padding: 12px 16px;
    color: #fff;
    font-size: 12px;
    line-height: 1.7;
}

.photo-controls {
    padding-bottom: calc(24px + var(--safe-bottom));
    background: rgba(0,0,0,0.9);
    flex-shrink: 0;
}

.btn-shutter {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.btn-shutter:active { transform: scale(0.95); }
.shutter-inner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.1s;
}
.btn-shutter:active .shutter-inner {
    transform: scale(0.88);
}

.geo-status { color: rgba(255,255,255,0.8); }

/* === Loading overlay === */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.loading-overlay.d-none { display: none !important; }

/* === Animation: card entrance === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.anim-in {
    animation: fadeInUp 0.3s ease forwards;
}

/* === Scrollbar (desktop) === */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c0c7d0; border-radius: 4px; }

/* === Tag color presets === */
.tag-bus       { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.tag-train     { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.tag-program   { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.tag-food      { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.tag-hotel     { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.tag-free      { background: #faf5ff; color: #6b21a8; border-color: #e9d5ff; }
.tag-doc       { background: #f0f9ff; color: #0c4a6e; border-color: #bae6fd; }
.tag-default   { background: #f8fafc; color: #475569; border-color: #e2e8f0; }

/* === Misc === */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Ripple effect for Android feel */
.select-card,
.event-card-header,
.btn-take-photo {
    -webkit-tap-highlight-color: transparent;
}