@import url('https://fonts.googleapis.com/css2?family=Mynerve&family=Sour+Gummy:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Luckiest+Guy&display=swap');

.mynerve-regular {
    font-family: "Mynerve", cursive;
    font-weight: 400;
    font-style: normal;
}

:root {
    --ocean-deep: #4E635E;
    --villa-nova: #E2E0C8;
    --siren-song: #A8B49E;
    --big-river: #818C78;
    --cream: #F5F3E8;
    --dark-accent: #3A4D47;
    --light-sage: #C8D4C2;
}

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

/* ============================================
   LOADING SCREEN STYLES
   ============================================ */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4E635E 0%, #818C78 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-container {
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.loader-logo {
    margin-bottom: 30px;
}

.logo-square {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #E2E0C8, #F5F3E8);
    border-radius: 20px;
    animation: float 3s ease-in-out infinite, rotateLogo 4s ease-in-out infinite;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

@keyframes rotateLogo {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(360deg); }
}

.loader-text {
    font-family: 'Luckiest Guy', cursive;
    font-size: 2.5rem;
    color: #E2E0C8;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.loader-spinner {
    width: 50px;
    height: 50px;
    margin: 30px auto;
    border: 4px solid rgba(226, 224, 200, 0.2);
    border-top: 4px solid #E2E0C8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 1.2rem;
    color: #C8D4C2;
    font-style: italic;
    animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   MAIN BODY STYLES
   ============================================ */

body {
    background: linear-gradient(135deg, rgba(78, 99, 94, 0.24) 0%, rgba(129, 140, 120, 0.24) 100%),
     url('assets/background3.gif');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    min-height: 100vh;
    font-family: 'Crimson Text', serif;
    color: var(--villa-nova);
}

/* Homepage Styles */
.home-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.header {
    text-align: center;
    margin-bottom: 60px;
}

.header h1 {
    font-family: 'Luckiest Guy', cursive;
    font-size: 3.5rem;
    color: var(--villa-nova);
    margin-bottom: 20px;
    text-shadow: 2px 2px 8px rgba(78, 99, 94, 0.6);
}

.header p {
    font-size: 1.2rem;
    color: var(--light-sage);
    font-style: italic;
}

/* Typing Animation */
.typing-animation {
    font-size: 1.3rem;
    color: var(--cream);
    min-height: 40px;
    height: 40px;
    line-height: 40px;
}

.sound-controls {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.sound-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ocean-deep), var(--big-river));
    border: 3px solid var(--villa-nova);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 6px 20px rgba(78, 99, 94, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sound-toggle:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 8px 25px rgba(78, 99, 94, 0.6);
}

.sound-toggle:active {
    transform: scale(0.95);
}

.music-controls {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 1000;
}

.music-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ocean-deep), var(--big-river));
    border: 3px solid var(--villa-nova);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 6px 20px rgba(78, 99, 94, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.music-toggle:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 8px 25px rgba(78, 99, 94, 0.6);
}

.music-toggle:active {
    transform: scale(0.95);
}

/* Music Toggle - Long Press Menu */
.music-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: rgba(78, 99, 94, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    border: 2px solid var(--villa-nova);
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.music-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.music-menu-item {
    padding: 10px 15px;
    color: var(--cream);
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.music-menu-item:hover {
    background: rgba(226, 224, 200, 0.2);
}

/* Playlist Panel */
.playlist-panel {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 320px;
    max-height: 450px;
    background: rgba(78, 99, 94, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 2px solid var(--villa-nova);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s ease;
    overflow: hidden;
}

.playlist-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.playlist-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--dark-accent), var(--ocean-deep));
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--villa-nova);
}

.playlist-header h3 {
    color: var(--cream);
    font-size: 1.1rem;
    font-family: 'Luckiest Guy', cursive;
}

.close-playlist {
    background: transparent;
    border: none;
    color: var(--villa-nova);
    font-size: 28px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-playlist:hover {
    transform: rotate(90deg);
    color: white;
}

.now-playing {
    padding: 15px 20px;
    background: rgba(168, 180, 158, 0.2);
    border-bottom: 1px solid rgba(226, 224, 200, 0.2);
}

.song-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.song-title {
    color: var(--cream);
    font-size: 0.95rem;
    font-weight: 600;
}

/* Equalizer Animation */
.equalizer {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 20px;
}

.equalizer span {
    width: 3px;
    background: var(--villa-nova);
    border-radius: 2px;
    animation: equalize 0.8s ease-in-out infinite;
}

.equalizer span:nth-child(1) {
    animation-delay: 0s;
}

.equalizer span:nth-child(2) {
    animation-delay: 0.2s;
}

.equalizer span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes equalize {
    0%, 100% { height: 5px; }
    50% { height: 18px; }
}

.playlist-songs {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
}

.playlist-songs::-webkit-scrollbar {
    width: 6px;
}

.playlist-songs::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.playlist-songs::-webkit-scrollbar-thumb {
    background: var(--villa-nova);
    border-radius: 3px;
}

.song-item {
    padding: 12px 15px;
    margin-bottom: 5px;
    background: rgba(226, 224, 200, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid transparent;
}

.song-item:hover {
    background: rgba(226, 224, 200, 0.2);
    transform: translateX(5px);
}

.song-item.playing {
    background: rgba(168, 180, 158, 0.3);
    border: 2px solid var(--villa-nova);
}

.song-icon {
    font-size: 18px;
}

.song-name {
    color: var(--cream);
    font-size: 0.9rem;
    flex: 1;
}

.song-duration {
    color: var(--light-sage);
    font-size: 0.75rem;
}

.journals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.journal-card {
    background: var(--villa-nova);
    background-image: url('https://www.transparenttextures.com/patterns/cream-paper.png');
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(78, 99, 94, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--big-river);
    position: relative;
    overflow: hidden;
}

.journal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--ocean-deep), var(--siren-song));
}

.journal-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(78, 99, 94, 0.5);
}

.journal-card h3 {
    font-family: 'Playfair Display', serif;
    color: var(--ocean-deep);
    margin-bottom: 10px;
    font-size: 1.4rem;
}

.journal-card .date {
    color: var(--big-river);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.journal-card .preview {
    color: #555;
    font-size: 1rem;
    line-height: 1.6;
    max-height: 80px;
    overflow: hidden;
}

.add-journal-card {
    background: linear-gradient(135deg, var(--ocean-deep) 0%, var(--big-river) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    border: 3px dashed var(--villa-nova);
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-journal-card:hover {
    background: linear-gradient(135deg, var(--dark-accent) 0%, var(--ocean-deep) 100%);
    transform: scale(1.02);
}

.add-journal-card .plus-icon {
    font-size: 4rem;
    color: var(--villa-nova);
    margin-bottom: 10px;
}

.add-journal-card p {
    color: var(--cream);
    font-size: 1.2rem;
    font-family: 'Playfair Display', serif;
}

/* Journal Editor Styles */
.editor-container {
    display: none;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.editor-header h2 {
    font-family: 'Playfair Display', serif;
    color: var(--villa-nova);
    font-size: 2rem;
}

.editor-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    background: var(--ocean-deep);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Crimson Text', serif;
    font-size: 16px;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(78, 99, 94, 0.3);
}

.btn:hover {
    background: var(--dark-accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(78, 99, 94, 0.4);
}

.btn-secondary {
    background: var(--big-river);
}

.btn-secondary:hover {
    background: var(--siren-song);
}

.paper-sheet {
    background-color: var(--villa-nova);
    background-image: url('https://www.transparenttextures.com/patterns/cream-paper.png');
    min-height: 70vh;
    padding: 50px;
    position: relative;
    box-shadow: 0 15px 50px rgba(78, 99, 94, 0.6);
    border-radius: 4px;
    border: 1px solid var(--big-river);
    animation: slideIn 0.5s ease-out;
}

.paper-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(
        transparent,
        transparent 31px,
        rgba(168, 180, 158, 0.3) 31px,
        rgba(168, 180, 158, 0.3) 32px
    );
    pointer-events: none;
    opacity: 0.4;
}

textarea {
    width: 100%;
    min-height: 500px;
    background: transparent;
    border: none;
    resize: vertical;
    font-size: 20px;
    line-height: 32px;
    color: #2d2d2d;
    outline: none;
    font-family: 'Sour Gummy', sans-serif;
    position: relative;
    z-index: 2;
}

textarea::placeholder {
    color: #999;
    font-style: italic;
}

.sticker {
    position: absolute;
    cursor: move;
    border: 5px solid white;
    box-shadow: 3px 3px 15px rgba(0,0,0,0.3);
    max-width: 200px;
    border-radius: 4px;
    transition: transform 0.2s;
    z-index: 10;
    touch-action: none;
}

.sticker:hover {
    transform: scale(1.05) rotate(2deg);
}

.sticker-controls {
    position: absolute;
    top: -35px;
    right: 0;
    display: flex;
    gap: 5px;
    background: rgba(78, 99, 94, 0.95);
    padding: 5px;
    border-radius: 5px;
    z-index: 100;
}

@media (max-width: 768px) {
    .sticker-controls {
        display: flex !important;
    }
}

@media (min-width: 769px) {
    .sticker-controls {
        display: none;
    }
    
    .sticker:hover .sticker-controls {
        display: flex;
    }
}

.sticker-btn {
    background: var(--villa-nova);
    color: var(--ocean-deep);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    touch-action: manipulation;
}

.sticker-btn:active {
    transform: scale(0.95);
}

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

@keyframes slideIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header h1 { 
        font-size: 2.5rem; 
    }
    
    .typing-animation {
        font-size: 1.1rem;
        height: 35px;
        min-height: 35px;
        line-height: 35px;
    }

    .loader-text {
        font-size: 2rem;
    }

    .logo-square {
        width: 60px;
        height: 60px;
    }

    .loading-text {
        font-size: 1rem;
    }
    
    .paper-sheet { 
        padding: 30px 20px; 
    }
    
    textarea { 
        font-size: 18px; 
        line-height: 28px; 
    }
    
    .journals-grid { 
        grid-template-columns: 1fr; 
    }
    
    .sound-controls {
        bottom: 20px;
        right: 20px;
    }

    .music-controls {
        bottom: 90px;
        right: 20px;
    }
    
    .sound-toggle, .music-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .playlist-panel {
        width: calc(100vw - 40px);
        right: -10px;
        bottom: 65px;
    }

    .sticker {
        max-width: 150px;
    }

    .sticker-btn {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }

    .editor-header h2 {
        font-size: 1.5rem;
    }

    .btn {
        padding: 10px 15px;
        font-size: 14px;
    }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--villa-nova);
}

.empty-state h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--cream);
}

.delete-btn {
    background: var(--ocean-deep);
    margin-top: 10px;
}

.delete-btn:hover {
    background: var(--dark-accent);
}