/* ============================================================
   OnFire Share – style.css
   Clean, mobile-first viewer for shared Notes and Displays.
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #222222;
    background: #f5f5f7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden {
    display: none !important;
}

/* --- App Shell --- */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
#share-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e5e5ea;
    font-size: 14px;
    color: #707781;
    flex-shrink: 0;
}

#share-header .logo {
    height: 28px;
    width: auto;
}

/* --- Main Content Area --- */
#content {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px 48px;
}

/* --- Loading Spinner --- */
#loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    font-size: 16px;
    color: #707781;
}

/* --- Note View --- */
#note-view {
    width: 100%;
    max-width: 800px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.note-header {
    padding: 32px 32px 0;
}

.note-title {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    color: #222222;
    margin-bottom: 8px;
}

.note-meta {
    font-size: 13px;
    color: #707781;
    margin-bottom: 24px;
}

.note-body {
    padding: 0 32px 32px;
}

/* Quill rendered content styling */
.note-body h1 {
    font-size: 2em;
    font-weight: 700;
    margin: 0.8em 0 0.4em;
    line-height: 1.3;
}

.note-body h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin: 0.8em 0 0.4em;
    line-height: 1.3;
}

.note-body h3 {
    font-size: 1.17em;
    font-weight: 600;
    margin: 0.6em 0 0.3em;
    line-height: 1.4;
}

.note-body p {
    margin: 0.5em 0;
}

.note-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
}

.note-body video {
    max-width: 100%;
    border-radius: 8px;
    margin: 12px 0;
}

.note-body a {
    color: #2D71EC;
    text-decoration: none;
}

.note-body a:hover {
    text-decoration: underline;
}

.note-body blockquote {
    border-left: 4px solid #FF6B1F;
    padding-left: 16px;
    margin: 12px 0;
    color: #555;
    font-style: italic;
}

.note-body pre {
    background: #f5f5f7;
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    font-family: 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 14px;
    margin: 12px 0;
}

.note-body code {
    background: #f0f0f2;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
}

.note-body pre code {
    background: none;
    padding: 0;
}

.note-body ul, .note-body ol {
    padding-left: 24px;
    margin: 8px 0;
}

.note-body li {
    margin: 4px 0;
}

.note-body hr {
    border: none;
    border-top: 1px solid #e5e5ea;
    margin: 24px 0;
}

/* Checklist items from Quill */
.note-body ul[data-checked="true"] li::before {
    content: '\2611';
    margin-right: 8px;
}

.note-body ul[data-checked="false"] li::before {
    content: '\2610';
    margin-right: 8px;
}

/* --- Display View (fullscreen slides) --- */
#display-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000;
    z-index: 100;
}

#slide-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

#slide-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#slide-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#slide-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

#slide-container .slide-html {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    padding: 40px;
    text-align: center;
}

#slide-container .slide-html h1 {
    font-size: 3em;
    font-weight: 700;
}

/* Audio slide */
.audio-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #ffffff;
    padding: 40px;
}

.audio-title {
    font-size: 2em;
    font-weight: 600;
    margin-bottom: 40px;
}

.waveform-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    height: 180px;
    margin-bottom: 32px;
}

.waveform-bar {
    width: 6px;
    background: #FF6B1F;
    border-radius: 3px;
    transition: height 0.1s ease;
    min-height: 4px;
}

.audio-progress {
    width: 60%;
    max-width: 500px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-bottom: 12px;
    overflow: hidden;
}

.audio-progress-fill {
    height: 100%;
    background: #FF6B1F;
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s linear;
}

.audio-time {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

/* Slide counter overlay */
#slide-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 110;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#slide-indicator.visible {
    opacity: 1;
}

/* --- Error View --- */
#error-view {
    text-align: center;
    padding: 60px 24px;
    max-width: 480px;
    width: 100%;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.error-message {
    font-size: 20px;
    font-weight: 600;
    color: #222222;
    margin-bottom: 8px;
}

.error-detail {
    font-size: 15px;
    color: #707781;
    margin-bottom: 32px;
    line-height: 1.5;
}

.cta-button {
    display: inline-block;
    background: #FF6B1F;
    color: #ffffff;
    padding: 12px 28px;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease;
}

.cta-button:hover {
    background: #e55a10;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    #content {
        padding: 16px 12px 32px;
    }

    .note-header {
        padding: 24px 20px 0;
    }

    .note-title {
        font-size: 22px;
    }

    .note-body {
        padding: 0 20px 24px;
    }

    .note-body h1 {
        font-size: 1.6em;
    }

    .note-body h2 {
        font-size: 1.3em;
    }

    .audio-player {
        padding: 24px;
    }

    .audio-title {
        font-size: 1.4em;
    }

    .audio-progress {
        width: 90%;
    }
}

/* --- Print Styles --- */
@media print {
    #share-header {
        border-bottom: 1px solid #ccc;
    }

    #content {
        padding: 0;
    }

    #note-view {
        box-shadow: none;
        border-radius: 0;
        max-width: 100%;
    }

    .note-body img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    #display-view,
    #error-view .cta-button {
        display: none;
    }
}
