/* Design System 
 * Colors:
 * - #F5F5F7 (Apple Off-White)
 * - #1D1D1F (True Black)
 * - #BF94E4 (Lavender accent)
 * 
 * Typography: SF Pro Text
 */

/* Base Styles */
:root {
    --apple-white: #F5F5F7;
    --true-black: #1D1D1F;
    --lavender: #BF94E4;
    --error-red: #FF3B30;
    --success-green: #34C759;
}

@font-face {
    font-family: 'SF Pro Text';
    src: local('SF Pro Text'), local('SFProText-Regular'),
         url('../assets/fonts/SFProText-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'SF Pro Text';
    src: local('SF Pro Text Bold'), local('SFProText-Bold'),
         url('../assets/fonts/SFProText-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

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

html, body {
    font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--apple-white);
    color: var(--true-black);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: none;
    height: 100%;
    position: relative;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3 {
    font-weight: bold;
}

h1 {
    font-size: 36px;
    margin-bottom: 30px;
}

h2 {
    font-size: 28px;
    margin-bottom: 24px;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.hidden {
    display: none !important;
}

/* Login Page */
#login-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#keypad-container {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    padding: 30px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

#password-display {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.password-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #E5E5E7;
    margin: 0 8px;
    transition: background 0.3s ease;
}

.password-dot.filled {
    background: var(--true-black);
}

#keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.key {
    height: 65px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    font-size: 24px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.key:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.8);
}

.key-clear, .key-enter {
    grid-column: span 1;
    font-size: 16px;
    border-radius: 20px;
}

#error-message {
    color: var(--error-red);
    margin-top: 15px;
    font-size: 14px;
}

#cooldown-message {
    margin-top: 15px;
    color: var(--error-red);
}

.cooldown-animation {
    height: 4px;
    background-color: var(--lavender);
    width: 100%;
    margin-top: 10px;
    transform-origin: left;
    animation: cooldown 30s linear forwards;
}

@keyframes cooldown {
    0% { transform: scaleX(1); }
    100% { transform: scaleX(0); }
}

/* Main Content */
.chapter {
    min-height: 100vh;
    padding: 80px 0;
    display: flex;
    align-items: center;
    scroll-margin-top: 20px;
    padding-bottom: 20px;
    overflow: visible !important;
}

/* Chapter 1: The Microphone */
#mic-model-container {
    height: 400px;
    margin: 40px 0;
    position: relative;
}

/* Chapter 2: Duet Fantasy */
#audio-visualizer-container {
    height: 300px;
    margin: 40px 0;
    position: relative;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    overflow: hidden;
    padding: 20px;
}

#start-visualizer {
    background: var(--lavender);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

#start-visualizer:active {
    transform: translate(-50%, -50%) scale(0.98);
}

#waveform {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Chapter 3: Cat & Cat */
#parallax-container {
    height: 500px;
    position: relative;
    overflow: hidden;
    margin: 40px 0;
    border-radius: 20px;
}

/* Notes Collection */
.note-container {
    position: relative;
    height: 100px;
    margin: 20px 0;
}

.music-note {
    position: absolute;
    width: 30px;
    height: 30px;
    background-image: url('../assets/images/music-note.svg');
    background-size: contain;
    background-repeat: no-repeat;
    animation: float 3s infinite ease-in-out;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.music-note:hover {
    transform: scale(1.2);
}

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

/* Finale */
#notes-counter {
    font-size: 24px;
    margin: 30px 0;
    color: var(--lavender);
    font-weight: bold;
}

#generate-card {
    background: var(--lavender);
    color: white;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 30px;
    transition: all 0.2s ease;
}

#generate-card:disabled {
    background: #CCCCCC;
    cursor: not-allowed;
}

#generate-card:not(:disabled):active {
    transform: scale(0.98);
}

#social-share {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 40px;
}

.share-btn {
    padding: 12px 20px;
    background: white;
    border: 1px solid #E5E5E7;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.share-btn:hover {
    border-color: var(--lavender);
    color: var(--lavender);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    h2 {
        font-size: 22px;
    }
    
    .key {
        height: 55px;
        font-size: 20px;
    }
    
    #mic-model-container {
        height: 300px;
    }
    
    #parallax-container {
        height: 400px;
    }
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    color: var(--true-black);
    font-size: 14px;
    z-index: 1000;
    max-width: 300px;
    border-left: 4px solid var(--lavender);
}

/* Birthday Letter Modal */
.letter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.letter-container {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.letter-header {
    display: flex;
    justify-content: flex-end;
    padding: 15px;
    border-bottom: 1px solid #f3f3f3;
}

.close-letter {
    width: 24px;
    height: 24px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.close-letter:hover {
    opacity: 0.8;
}

.letter-content {
    padding: 30px;
    overflow-y: auto;
    flex-grow: 1;
}

.letter-text {
    font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.8;
    color: var(--true-black);
}

.letter-text p {
    margin-bottom: 20px;
}

.letter-recipient {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 30px;
    color: var(--lavender);
}

.letter-bullets {
    margin: 25px 0;
}

.letter-bullet-item {
    position: relative;
    padding-left: 25px;
    margin-bottom: 10px;
}

.letter-bullet-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 8px;
    height: 8px;
    background-color: var(--lavender);
    border-radius: 50%;
}

.letter-signature {
    margin-top: 30px;
    font-style: italic;
    text-align: right;
}

/* Hidden note animation */
@keyframes glow {
    0% { box-shadow: 0 0 10px 2px rgba(191, 148, 228, 0.3); }
    100% { box-shadow: 0 0 20px 6px rgba(191, 148, 228, 0.6); }
}

.hidden-note {
    transition: opacity 0.5s, transform 0.5s;
}

.singing-note {
    z-index: 10;
}

/* Photo Gallery */
.photo-gallery-container {
    height: auto;
    min-height: 800px;
    width: 100%;
    position: relative;
    margin: 40px 0;
    border-radius: 20px;
    overflow: visible;
    padding-bottom: 40px;
    -webkit-overflow-scrolling: touch;
}

.photo-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 20px;
    margin-bottom: 30px;
    width: 100%;
    height: auto;
    overflow: visible;
}

.gallery-photo-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    max-height: 300px;
}

.gallery-photo-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.gallery-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-note {
    z-index: 10;
    pointer-events: auto;
    cursor: pointer;
    width: 40px;
    height: 40px;
}

/* Photo Modal */
.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.photo-modal-content {
    position: relative;
    max-width: 95%;
    max-height: 95vh;
    border-radius: 10px;
    overflow: hidden;
    background: white;
}

.photo-modal-content img {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    margin: 0 auto;
}

.close-photo {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 30px;
    color: white;
    cursor: pointer;
    z-index: 10;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
}

.photo-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--apple-white);
}

.prev-photo, .next-photo {
    background: var(--lavender);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.prev-photo:disabled, .next-photo:disabled {
    background: #CCCCCC;
    cursor: not-allowed;
}

.photo-indicator {
    font-size: 14px;
    color: var(--true-black);
}

/* Responsive Gallery - Fixed for all devices */
@media (max-width: 768px) {
    .photo-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 15px;
    }
    
    .photo-gallery-container {
        min-height: 800px;
        margin: 20px 0;
    }
    
    .gallery-photo-item {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .photo-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 10px;
        padding-bottom: 20px;
    }
    
    .photo-gallery-container {
        min-height: 600px; /* Set fixed minimum height */
        padding-bottom: 60px;
        margin-bottom: 40px;
    }
    
    .gallery-photo-item {
        max-height: 150px;
    }
    
    /* Make sure content is visible */
    .chapter {
        min-height: calc(100vh + 200px);
    }
    
    /* Fix modal for mobile */
    .photo-modal-content {
        max-width: 95%;
        max-height: 95vh;
    }
    
    /* Mobile cat controls */
    .cat-sound-controls {
        bottom: 70px !important;
        left: 10px !important;
        display: flex;
        flex-wrap: wrap;
    }
    
    .cat-sound-btn {
        margin-bottom: 5px !important;
        font-size: 12px !important;
    }
    
    #cat-game-button {
        top: 5px !important;
        right: 5px !important;
        font-size: 12px !important;
        padding: 5px 10px !important;
    }
    
    /* Hide cat cursor on mobile */
    .cat-cursor {
        display: none !important;
    }
}

/* Microphone Rotation Hint */
.rotate-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    text-align: center;
    z-index: 10;
    animation: fade-in 0.5s ease-in;
    max-width: 80%;
}

@keyframes fade-in {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Cat style animations */
@keyframes paw-print {
    0% { 
        opacity: 0.8; 
        transform: scale(1);
    }
    100% { 
        opacity: 0; 
        transform: scale(0.5);
    }
}

/* Cat Background Animation Styles */
.cat-background {
    background-color: transparent;
    overflow: hidden;
}

.walking-cat {
    transform-origin: center bottom;
    animation: float-cat 3s infinite alternate ease-in-out;
    z-index: -1;
}

@keyframes float-cat {
    0% { transform: translateY(0) rotate(0); }
    100% { transform: translateY(-10px) rotate(5deg); }
}

/* Cat Game Improvements */
#cat-game-button {
    transition: all 0.3s ease;
}

#cat-game-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(191, 148, 228, 0.7);
}

.cat-hint-button {
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cat-hint-button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(191, 148, 228, 0.6);
}

/* Cat Game Modal Improvements */
.cat-game-modal {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.cat-card {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.5s, box-shadow 0.3s;
}

.cat-card:hover {
    box-shadow: 0 6px 12px rgba(191, 148, 228, 0.5);
}

.cat-card.matched {
    box-shadow: 0 0 15px rgba(191, 148, 228, 0.8);
}

/* Ensure hints are visible on mobile */
@media (max-width: 480px) {
    .cat-hint-button {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 10px;
    }
    
    #cat-game-button {
        right: 10px;
        top: 10px;
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Cat game integrated section styles */
.cat-game-area {
    margin-top: 40px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.cat-game-area:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(191, 148, 228, 0.2);
}

.cat-game-title h3 {
    color: #1D1D1F;
    font-size: 22px;
    margin-bottom: 5px;
}

.cat-game-title p {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.cat-note-highlight {
    color: #BF94E4;
    font-weight: bold;
}

.cat-game-preview {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.cat-card-preview {
    width: 40px;
    height: 40px;
    background: #BF94E4;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.cat-card-preview:hover {
    transform: scale(1.1) rotate(5deg);
}

.start-cat-game-btn {
    background: #BF94E4;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(191, 148, 228, 0.3);
}

.start-cat-game-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(191, 148, 228, 0.4);
}

.start-cat-game-btn:active {
    transform: scale(0.98);
}

.start-cat-game-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Fix z-index for all music notes to ensure they're always clickable */
.music-note {
    z-index: 100 !important; /* Override any existing z-index */
    position: absolute;
    pointer-events: auto !important; /* Ensure notes are always clickable */
}

/* Special styling for cat bonus notes */
.cat-bonus-note {
    z-index: 1500 !important; /* Even higher z-index for bonus notes */
    filter: drop-shadow(0 0 8px rgba(191, 148, 228, 0.8));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.cat-bonus-note:hover {
    transform: scale(1.3) !important;
    filter: drop-shadow(0 0 12px rgba(191, 148, 228, 1));
}

/* Make notifications more visible */
.notification {
    z-index: 2000 !important; /* Ensure notifications are always on top */
}

/* Responsive styles for cat game */
@media (max-width: 768px) {
    .cat-game-area {
        padding: 15px;
        margin-top: 30px;
    }
    
    .cat-game-title h3 {
        font-size: 18px;
    }
    
    .cat-game-title p {
        font-size: 12px;
    }
    
    .cat-card-preview {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .start-cat-game-btn {
        padding: 8px 15px;
        font-size: 14px;
    }
}

/* Card note styles */
.card-note {
    transition: transform 0.3s ease, filter 0.3s ease;
    transform-origin: center center;
}

.card-note:hover {
    transform: scale(1.1) !important;
    filter: drop-shadow(0 0 10px rgba(191, 148, 228, 0.8));
}

/* Success overlay fade in animation */
.success-overlay {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 0.7; }
}

/* Checkmark styles */
.collected .checkmark {
    animation: bounceIn 0.5s ease forwards;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Make sure close button is always visible */
.cat-game-modal button {
    opacity: 1 !important;
    cursor: pointer !important;
    transition: transform 0.2s ease, background-color 0.3s ease;
}

.cat-game-modal button:hover {
    transform: scale(1.05);
}

.cat-game-modal button:active {
    transform: scale(0.95);
} 