/* ==========================================
   Museum Memory Kiosk - Styles
   The Little Museum of Dublin
   Brand: #004924 (dark green), #FF84A9 (pink), #C8E6C8 (light green)
   Font: EB Garamond (serif)
   Optimized for iPad in fullscreen/kiosk mode
   ========================================== */

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

:root {
    --green-dark:    #004924;
    --green-mid:     #005f2e;
    --green-light:   #C8E6C8;
    --pink:          #FF84A9;
    --pink-dark:     #e5607f;
    --white:         #ffffff;
    --cream:         #faf8f4;
    --text-on-green: #ffffff;
    --text-dark:     #1a1a1a;
    --text-muted:    #5a7a65;
    --border-radius: 12px;
    --transition-speed: 0.3s;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--green-dark);
    color: var(--text-on-green);
}

/* Disable text selection and touch callouts */
body {
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* App Container */
#app {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed), visibility var(--transition-speed);
    background: var(--green-dark);
}

.screen.active {
    opacity: 1;
    visibility: visible;
    z-index: 10;
}

/* Conversation screen uses cream background for readability */
#conversation-screen {
    background: var(--cream);
}

#generating-screen {
    background: var(--green-dark);
}

.content {
    width: 90%;
    max-width: 820px;
    text-align: center;
    padding: 40px;
}

/* Museum Logo */
.museum-logo {
    width: 260px;
    max-width: 70%;
    margin-bottom: 36px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Typography */
h1 {
    font-size: 54px;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 18px;
    line-height: 1.15;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 40px;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 18px;
    line-height: 1.2;
}

/* Headings inside conversation screen use dark text */
#conversation-screen h2 {
    color: var(--green-dark);
}

.subtitle {
    font-size: 26px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 44px;
    line-height: 1.5;
}

.message {
    font-size: 22px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.65;
    margin-bottom: 28px;
}

.instruction {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 22px;
    font-style: italic;
}

/* Buttons */
button {
    font-family: 'EB Garamond', Georgia, serif;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all var(--transition-speed);
    -webkit-tap-highlight-color: transparent;
}

.primary-btn {
    background: var(--pink);
    color: var(--white);
    font-size: 30px;
    font-weight: 600;
    padding: 24px 64px;
    border-radius: var(--border-radius);
    min-height: 78px;
    min-width: 220px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 20px rgba(255, 132, 169, 0.4);
}

.primary-btn:active {
    transform: scale(0.97);
    background: var(--pink-dark);
    box-shadow: 0 2px 8px rgba(255, 132, 169, 0.3);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    font-size: 26px;
    font-weight: 500;
    padding: 18px 48px;
    border-radius: var(--border-radius);
    min-height: 68px;
    min-width: 190px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(4px);
}

.secondary-btn:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.25);
}

.control-btn {
    background: var(--white);
    color: var(--green-dark);
    font-size: 20px;
    font-family: 'EB Garamond', Georgia, serif;
    padding: 14px 28px;
    border-radius: var(--border-radius);
    min-height: 58px;
    margin: 0 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--green-light);
}

.control-btn:active {
    transform: scale(0.95);
    background: var(--green-light);
}

/* Icons */
.icon-large {
    font-size: 100px;
    margin-bottom: 28px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Progress Bar */
.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--green-light);
    z-index: 100;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green-dark), var(--pink));
    width: 0%;
    transition: width 0.5s ease;
}

/* State Indicator */
.state-indicator {
    position: relative;
    margin: 50px auto;
    width: 180px;
    height: 180px;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: var(--pink);
    opacity: 0.25;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.4;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.15;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.4;
    }
}

.state-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 72px;
    z-index: 10;
}

.state-text {
    position: absolute;
    bottom: -48px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 26px;
    font-weight: 600;
    color: var(--green-dark);
    white-space: nowrap;
}

/* State Variations */
.state-indicator.listening .pulse-ring {
    background: var(--pink);
}

.state-indicator.thinking .pulse-ring {
    background: var(--green-dark);
    animation: pulse 1s infinite;
}

.state-indicator.confirming .pulse-ring {
    background: var(--green-mid);
}

.state-indicator.sending .pulse-ring {
    background: var(--pink);
}

/* Conversation Display */
.conversation-display {
    min-height: 280px;
    margin: 44px auto;
    padding: 28px;
    background: var(--white);
    border-radius: var(--border-radius);
    text-align: left;
    border: 1px solid var(--green-light);
    box-shadow: 0 2px 12px rgba(0, 73, 36, 0.08);
}

.message {
    padding: 18px 22px;
    margin: 14px 0;
    border-radius: var(--border-radius);
    font-size: 22px;
    line-height: 1.6;
}

.ai-message {
    background: var(--cream);
    border-left: 4px solid var(--green-dark);
    color: var(--text-dark);
}

.user-message {
    background: var(--green-dark);
    color: var(--white);
    border-left: 4px solid var(--pink);
}

.message.empty {
    opacity: 0.45;
    font-style: italic;
}

/* Manual Controls */
.manual-controls {
    margin-top: 28px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.manual-controls.hidden {
    display: none;
}

/* Spinner */
.spinner {
    width: 72px;
    height: 72px;
    margin: 0 auto 36px;
    border: 7px solid rgba(255, 255, 255, 0.2);
    border-top: 7px solid var(--pink);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Countdown */
.countdown {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 28px;
}

.countdown span {
    font-weight: 700;
    color: var(--pink);
    font-size: 26px;
}

/* Error Styling */
#error-screen .icon-large {
    color: var(--pink);
}

#error-screen h2 {
    color: var(--white);
}

/* Debug Panel */
.debug-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 300px;
    max-height: 400px;
    background: rgba(0, 0, 0, 0.9);
    color: #00ff00;
    font-family: monospace;
    font-size: 12px;
    padding: 10px;
    overflow-y: auto;
    z-index: 9999;
    border-top-left-radius: 8px;
}

.debug-panel.hidden {
    display: none;
}

.debug-panel h3 {
    color: #00ff00;
    font-size: 14px;
    margin-bottom: 10px;
}

#debug-content {
    white-space: pre-wrap;
    word-break: break-all;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Accessibility - High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --green-dark: #002a15;
        --white: #ffffff;
        --pink: #ff4080;
    }
}

/* Landscape Orientation Optimization */
@media (orientation: landscape) {
    .content {
        max-width: 1000px;
    }

    .conversation-display {
        max-height: 380px;
        overflow-y: auto;
    }

    .museum-logo {
        width: 200px;
        margin-bottom: 20px;
    }

    h1 {
        font-size: 44px;
    }

    .state-indicator {
        margin: 30px auto;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Admin Settings Link */
.admin-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 46px;
    height: 46px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 1000;
    transition: background var(--transition-speed), transform var(--transition-speed);
    backdrop-filter: blur(4px);
}

.admin-link:hover,
.admin-link:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}
