/* ============================================
   HOLLY'S KITCHEN - Refined Mediterranean
   ============================================ */

:root {
    --terracotta: #B8705A;
    --terracotta-light: #CFA090;
    --olive: #6B7263;
    --olive-muted: #8A9182;
    --cream: #F7F5F2;
    --cream-dark: #EDE9E4;
    --sand: #E4DED6;
    --brown: #3D3632;
    --brown-light: #6B635C;
    --white: #FDFCFB;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    color: var(--brown);
    line-height: 1.65;
    perspective: 1500px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, .logo, .page-title, .recipe-header h1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
}

/* ============================================
   BACKGROUND
   ============================================ */

.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(165deg, var(--cream) 0%, var(--sand) 100%);
    z-index: -1;
}

/* ============================================
   BOOK CONTAINER
   ============================================ */

.book-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transform-style: preserve-3d;
}

/* ============================================
   FLOATING PAGES
   ============================================ */

.page {
    position: absolute;
    width: calc(100% - 48px);
    max-width: 460px;
    height: calc(100% - 48px);
    max-height: 760px;
    background: var(--white);
    border-radius: 3px;
    border: 1px solid var(--sand);
    overflow: hidden;
    box-shadow:
        0 20px 40px rgba(61, 54, 50, 0.08),
        0 8px 16px rgba(61, 54, 50, 0.04);
    transition:
        transform 0.55s cubic-bezier(0.4, 0.0, 0.2, 1),
        opacity 0.55s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform-style: preserve-3d;
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%) rotateY(-10deg) scale(0.96);
}

.page.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0) rotateY(0deg) scale(1);
    z-index: 10;
}

.page.prev {
    opacity: 0;
    transform: translateX(-100%) rotateY(10deg) scale(0.96);
}

.page.next {
    opacity: 0;
    transform: translateX(100%) rotateY(-10deg) scale(0.96);
}

.page-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ============================================
   COVER
   ============================================ */

.cover-page {
    background: var(--terracotta);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cover-page::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
    bottom: 24px;
    border: 1px solid rgba(255,255,255,0.25);
    pointer-events: none;
}

.cover-content {
    text-align: center;
    color: var(--white);
    padding: 48px 32px;
}

.cover-title {
    font-family: 'Syne', sans-serif;
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: 56px;
}

.cover-open-btn {
    padding: 14px 48px;
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.7);
    border-radius: 2px;
    color: var(--white);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cover-open-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--white);
    transform: none;
}

/* ============================================
   HEADER
   ============================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--cream-dark);
    flex-shrink: 0;
}

.logo {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--terracotta);
}

.header-actions {
    display: flex;
    gap: 6px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--cream-dark);
    background: transparent;
    border-radius: 6px;
    color: var(--brown-light);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    border-color: var(--olive-muted);
    color: var(--olive);
}

.icon-btn.favorited {
    background: var(--terracotta);
    border-color: var(--terracotta);
    color: white;
}

.icon-btn svg {
    width: 17px;
    height: 17px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    background: transparent;
    border: 1px solid var(--cream-dark);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--brown-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    border-color: var(--olive-muted);
    color: var(--olive);
}

.back-btn svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   CONTENT
   ============================================ */

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px 28px;
    -webkit-overflow-scrolling: touch;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 500;
    margin-bottom: 20px;
    color: var(--brown);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-icon {
    display: inline-flex;
    width: 24px;
    height: 24px;
    color: var(--olive);
}

.section-icon svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   HOME - SECTIONS
   ============================================ */

.surprise-btn {
    width: 100%;
    padding: 13px;
    background: transparent;
    border: 1px solid var(--olive-muted);
    border-radius: 6px;
    color: var(--olive);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.surprise-btn:hover {
    background: var(--olive);
    border-color: var(--olive);
    color: var(--white);
}

.sections-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.section-card {
    background: var(--cream);
    border: none;
    border-radius: 8px;
    padding: 20px 14px 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.section-card:hover {
    background: var(--cream-dark);
}

.card-icon {
    display: block;
    width: 28px;
    height: 28px;
    margin: 0 auto 10px;
    color: var(--olive-muted);
}

.card-icon svg {
    width: 100%;
    height: 100%;
}

.section-card:hover .card-icon {
    color: var(--olive);
}

.section-card h2 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--brown);
}

.section-count {
    font-size: 0.72rem;
    color: var(--brown-light);
    letter-spacing: 0.02em;
}

/* ============================================
   RECIPE LIST
   ============================================ */

.recipe-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.recipe-card {
    background: var(--cream);
    border: none;
    border-radius: 8px;
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recipe-card:hover {
    background: var(--cream-dark);
}

.recipe-card h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--brown);
}

.recipe-card .recipe-time {
    font-size: 0.75rem;
    color: var(--brown-light);
}

.recipe-card .fav-indicator {
    color: var(--terracotta);
}

.recipe-card .fav-indicator svg {
    width: 14px;
    height: 14px;
    fill: var(--terracotta);
}

/* ============================================
   RECIPE PAGE
   ============================================ */

.recipe-page-content {
    padding-bottom: 32px;
}

.recipe-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--cream-dark);
}

.recipe-header h1 {
    font-size: 1.55rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--brown);
}

.recipe-subtitle {
    font-size: 0.9rem;
    color: var(--brown-light);
    font-style: italic;
    margin-bottom: 10px;
}

.recipe-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--brown-light);
}

.meta-divider {
    opacity: 0.4;
}

.fun-fact {
    background: var(--cream);
    border-left: 2px solid var(--olive-muted);
    border-radius: 0 8px 8px 0;
    padding: 14px 16px;
    margin-bottom: 24px;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--brown-light);
    line-height: 1.7;
}

.recipe-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.ingredients-section h2,
.steps-section h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--terracotta);
}

.scale-controls {
    display: flex;
    gap: 3px;
}

.scale-btn {
    padding: 4px 9px;
    border: 1px solid var(--cream-dark);
    background: transparent;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--brown-light);
    cursor: pointer;
    transition: all 0.15s ease;
}

.scale-btn:hover,
.scale-btn.active {
    background: var(--terracotta);
    border-color: var(--terracotta);
    color: white;
}

.ingredients-list {
    list-style: none;
}

.ingredients-list li {
    padding: 9px 0;
    border-bottom: 1px solid var(--cream);
    font-size: 0.9rem;
}

.ingredients-list li:last-child {
    border-bottom: none;
}

.ingredient-amount {
    font-weight: 600;
    color: var(--terracotta);
}

.steps-list {
    list-style: none;
    counter-reset: step;
}

.steps-list li {
    counter-increment: step;
    padding: 12px 0 12px 34px;
    position: relative;
    border-bottom: 1px solid var(--cream);
    font-size: 0.9rem;
    line-height: 1.65;
}

.steps-list li:last-child {
    border-bottom: none;
}

.steps-list li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 12px;
    width: 22px;
    height: 22px;
    background: var(--olive);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.7rem;
}

/* ============================================
   NOTES
   ============================================ */

.notes-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--cream-dark);
}

.notes-section h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--brown);
}

.notes-section textarea {
    width: 100%;
    min-height: 72px;
    padding: 11px 13px;
    border: 1px solid var(--cream-dark);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    background: var(--cream);
    transition: border-color 0.2s ease;
}

.notes-section textarea:focus {
    border-color: var(--olive-muted);
}

.notes-section textarea::placeholder {
    color: var(--brown-light);
    opacity: 0.6;
}

/* ============================================
   SEARCH
   ============================================ */

.search-bar {
    margin-bottom: 18px;
}

.search-bar input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--cream-dark);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    background: var(--cream);
    transition: border-color 0.2s ease;
}

.search-bar input:focus {
    border-color: var(--olive-muted);
}

.search-bar input::placeholder {
    color: var(--brown-light);
    opacity: 0.6;
}

.search-title {
    font-size: 0.85rem;
    color: var(--brown-light);
    margin-bottom: 14px;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--brown-light);
}

.empty-state p {
    margin-bottom: 4px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.empty-state p:first-child {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.05rem;
    color: var(--brown);
    margin-bottom: 6px;
}

/* ============================================
   TOAST
   ============================================ */

.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--brown);
    color: var(--white);
    padding: 11px 22px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================
   PRINT
   ============================================ */

@media print {
    .app-background,
    .page-header,
    .scale-controls,
    .notes-section,
    .toast {
        display: none !important;
    }

    body { background: white; }

    .page {
        position: static;
        width: 100%;
        max-width: none;
        height: auto;
        box-shadow: none;
        border-radius: 0;
        opacity: 1;
        transform: none;
    }

    .page-content { overflow: visible; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 400px) {
    .book-container { padding: 16px; }

    .page {
        width: calc(100% - 32px);
        height: calc(100% - 32px);
        border-radius: 10px;
    }

    .sections-grid { gap: 8px; }
    .section-card { padding: 18px 12px; }
    .page-content { padding: 18px 16px 24px; }
    .cover-title { font-size: 2.6rem; }
}

@media (min-width: 768px) {
    .page { max-width: 500px; }
}
