/* ============================================================
   Kebap Hocası - Dijital Menü Styles
   Color palette derived from logo (#6d9390 teal/sage)
   WCAG AA contrast compliance throughout
   ============================================================ */

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

:root {
    /* Brand colors from logo SVG */
    --teal:        #6d9390;
    --teal-dark:   #4a6b68;
    --teal-darker: #2f4745;
    --teal-light:  #8fb3b0;
    --teal-pale:   #e8f0ef;

    /* Backgrounds */
    --bg-primary:  #1e3432;  /* dark teal – AA on white text: 10.5:1 */
    --bg-surface:  #253f3d;  /* slightly lighter */
    --bg-elevated: #2f4e4b;

    /* Text – all pass AA on respective backgrounds */
    --text-primary:   #f0f7f6;  /* on dark bg: 12.1:1 */
    --text-secondary: #a8c5c3;  /* on dark bg: 5.2:1 */
    --text-on-teal:   #ffffff;  /* on --teal: 4.6:1 AA large text */

    /* Accent */
    --accent:       #6d9390;
    --accent-hover: #8fb3b0;

    /* Misc */
    --shadow: 0 4px 24px rgba(0,0,0,0.35);
    --radius: 12px;
    --toolbar-h: 52px;
    --thumb-h: 80px;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Focus visible for keyboard users */
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* ===== Screen Management ===== */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}
.screen.active {
    display: flex;
}

/* ===== Upload Screen ===== */
#upload-screen {
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #1e3432 0%, #253f3d 50%, #2f4e4b 100%);
}

.upload-container {
    text-align: center;
    max-width: 460px;
    width: 90%;
}

.upload-logo {
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.upload-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
    line-height: 1.2;
}
.upload-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.upload-area {
    border: 2px dashed var(--teal);
    border-radius: var(--radius);
    padding: 40px 24px;
    cursor: pointer;
    transition: all 0.25s ease;
    background: rgba(109, 147, 144, 0.06);
}
.upload-area:hover,
.upload-area:focus-visible,
.upload-area.dragover {
    border-color: var(--accent-hover);
    background: rgba(109, 147, 144, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(109, 147, 144, 0.15);
}

.upload-icon {
    color: var(--accent);
    margin-bottom: 12px;
}

.upload-text {
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}
.upload-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ===== Loading Screen ===== */
#loading-screen {
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    flex-direction: column;
}

.loading-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-logo {
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(109, 147, 144, 0.25);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.progress-bar {
    width: 240px;
    height: 6px;
    background: rgba(109, 147, 144, 0.2);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--teal-dark), var(--accent));
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ===== Toolbar ===== */
.toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--toolbar-h);
    background: rgba(30, 52, 50, 0.92);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    padding: 0 12px;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(0,0,0,0.25);
}

.toolbar-left {
    display: flex;
    align-items: center;
}
.toolbar-logo {
    border-radius: 50%;
}

.toolbar-center {
    flex: 1;
    text-align: center;
}
.toolbar-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: block;
    line-height: 1.2;
}
.page-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.toolbar-right {
    display: flex;
    gap: 4px;
}

.tool-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.tool-btn:hover {
    background: rgba(109, 147, 144, 0.2);
}

/* ===== Flipbook Viewport ===== */
#flipbook-screen {
    flex-direction: column;
    background: var(--bg-primary);
}

.flipbook-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: var(--toolbar-h);
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.flipbook-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#book-container {
    width: 100%;
    height: 100%;
}

/* StPageFlip wrapper should fill its container */
.stf__wrapper {
    margin: 0 auto !important;
}

/* Blank page (cover spacer) */
.page-blank {
    background: var(--bg-primary) !important;
}

/* Page styling */
.flipbook-stage .page-content {
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.flipbook-stage .page-content img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

/* StPageFlip wrapper shadow */
.stf__wrapper {
    box-shadow: 0 0 30px rgba(0,0,0,0.4) !important;
}

/* ===== Nav Buttons ===== */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(74, 107, 104, 0.85);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.nav-btn:hover {
    background: var(--accent);
    transform: translateY(-50%) scale(1.08);
}
.nav-prev { left: 12px; }
.nav-next { right: 12px; }

/* ===== Thumbnail Strip ===== */
.thumbnail-strip {
    height: var(--thumb-h);
    background: rgba(30, 52, 50, 0.92);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
}
.thumbnail-strip::-webkit-scrollbar {
    height: 3px;
}
.thumbnail-strip::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.thumb-item {
    flex-shrink: 0;
    width: 44px;
    height: 62px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    background: #fff;
}
.thumb-item:hover {
    border-color: var(--teal-light);
}
.thumb-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(109, 147, 144, 0.4);
}
.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* ===== Responsive / Mobile ===== */
@media (max-width: 768px) {
    :root {
        --toolbar-h: 44px;
        --thumb-h: 56px;
    }

    .upload-logo { width: 120px; height: 120px; }
    .upload-title { font-size: 1.6rem; }
    .upload-area { padding: 28px 16px; }

    .nav-btn {
        width: 36px;
        height: 36px;
    }
    .nav-prev { left: 6px; }
    .nav-next { right: 6px; }

    .thumb-item { width: 36px; height: 50px; }

    .toolbar-title { font-size: 0.85rem; }
    .toolbar-logo { width: 30px; height: 30px; }
}

@media (max-width: 480px) {
    .nav-btn {
        width: 32px;
        height: 32px;
        opacity: 0.7;
    }
    .nav-prev { left: 4px; }
    .nav-next { right: 4px; }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Skip Link (a11y) ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
