/* ========================================
   GLOBAL RESET
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========================================
   LANDING PAGE STYLES (index.html)
   ======================================== */
body.landing {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive, sans-serif;
    background: linear-gradient(180deg, #1a2a6c 0%, #4a5fa8 40%, #7ba0d4 70%, #b8d4f5 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Animated stars */
.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    z-index: 1;
    pointer-events: none;
}

.star {
    position: absolute;
    color: #fff;
    font-size: 20px;
    animation: twinkle 2s infinite ease-in-out;
}

.star:nth-child(1) { top: 10%; left: 20%; animation-delay: 0s; }
.star:nth-child(2) { top: 20%; left: 80%; animation-delay: 0.5s; }
.star:nth-child(3) { top: 15%; left: 50%; animation-delay: 1s; }
.star:nth-child(4) { top: 30%; left: 10%; animation-delay: 1.5s; }
.star:nth-child(5) { top: 25%; left: 90%; animation-delay: 0.8s; }
.star:nth-child(6) { top: 5%; left: 70%; animation-delay: 1.2s; }

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

/* Floating clouds */
.clouds {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.cloud {
    position: absolute;
    font-size: 40px;
    animation: float 20s infinite linear;
}

.cloud:nth-child(1) { top: 70%; left: -10%; animation-duration: 25s; }
.cloud:nth-child(2) { top: 75%; left: -20%; animation-duration: 30s; animation-delay: 5s; }
.cloud:nth-child(3) { top: 80%; left: -15%; animation-duration: 35s; animation-delay: 10s; }

@keyframes float {
    from { transform: translateX(0); }
    to { transform: translateX(120vw); }
}

/* Main content container for landing page */
.container {
    text-align: center;
    z-index: 10;
    position: relative;
}

.sandman {
    font-size: 120px;
    margin-bottom: 20px;
    animation: bounce 2s infinite ease-in-out;
}

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

body.landing h1 {
    color: #fff;
    font-size: 48px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
    margin-bottom: 10px;
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    from { text-shadow: 3px 3px 6px rgba(255,255,255,0.3); }
    to { text-shadow: 3px 3px 20px rgba(255,255,255,0.8); }
}

.subtitle {
    color: #e3f2fd;
    font-size: 24px;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.sleep-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 25px 60px;
    font-size: 32px;
    font-family: inherit;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sleep-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(102,126,234,0.5);
}

.sleep-button:active {
    transform: translateY(-2px);
}

.sleep-button::before {
    content: '✨';
    position: absolute;
    left: 20px;
    font-size: 28px;
    animation: sparkle 1.5s infinite;
}

.sleep-button::after {
    content: '✨';
    position: absolute;
    right: 20px;
    font-size: 28px;
    animation: sparkle 1.5s infinite 0.75s;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
    50% { opacity: 0.5; transform: scale(1.3) rotate(180deg); }
}

/* Moon */
.moon {
    position: absolute;
    top: 10%;
    right: 15%;
    font-size: 80px;
    animation: rotate 20s infinite linear;
    z-index: 1;
    pointer-events: none;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   DREAMS PAGE STYLES (ai_handler.py)
   ======================================== */
body {
    font-family: Arial, sans-serif;
    max-width: 800px;
    margin: 50px auto;
    padding: 20px;
    background-color: #f5f5f5;
}

h1 {
    color: #333;
    text-align: center;
}

.intro {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.ai-response {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-left: 4px solid #2196f3;
}

.ai-response p {
    color: #1565c0;
    font-size: 18px;
    line-height: 1.6;
    margin: 0;
}

.model-info {
    text-align: right;
    color: #999;
    font-size: 12px;
    margin-top: 5px;
}

.save-button {
    display: block;
    margin: 20px auto;
    padding: 12px 30px;
    background-color: #2196f3;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.save-button:hover {
    background-color: #1976d2;
}

.save-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.message {
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
}

.success {
    background-color: #c8e6c9;
    color: #2e7d32;
}

.error {
    background-color: #ffcdd2;
    color: #c62828;
}

.previous-dreams {
    margin-top: 40px;
}

.previous-dreams h2 {
    color: #666;
    font-size: 20px;
    margin-bottom: 20px;
}

.dream-item {
    background: linear-gradient(135deg, #f5f9ff 0%, #e8f2ff 100%);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-left: 3px solid #90caf9;
}

.dream-item p {
    color: #5c8ab8;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 8px 0;
}

.dream-meta {
    color: #999;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.delete-button {
    background-color: #ef9a9a;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.delete-button:hover {
    background-color: #e57373;
}

.delete-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}
