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

body {
    font-family: 'Samsung One', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #4a5bb8 0%, #5a428a 100%);
    min-height: 100vh;
    color: #1a1a1a;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border-radius: 0;
}

/* Header Styles */
.header {
    background: #7176D5;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding: 1.5rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0 0 32px 32px;
    margin-bottom: 1rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.header-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.app-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    white-space: nowrap;
}

.header-quote {
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.header-quote h2 {
    display: none;
}

.settings-btn, .back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover, .back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    padding: 0.5rem 1.5rem 1.5rem 1.5rem;
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

/* Card Styles */
.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.card-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></svg>');
    opacity: 0.1;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.card-content {
    padding: 1.5rem;
}

/* Weather Styles */
.weather-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.weather-item {
    background: linear-gradient(135deg, #f8f9ff 0%, #e8eeff 100%);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid rgba(30, 60, 114, 0.1);
}

.weather-item i {
    color: #1e3c72;
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.weather-item div {
    font-weight: 500;
    color: #333;
}

/* Traffic Styles */
.traffic-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Palette overrides */
body.cool {
    background: linear-gradient(135deg, #4a5bb8 0%, #5a428a 100%);
}
body.cool .header { background: #7176D5; }
body.cool .card-header { background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); }

body.warm {
    background: linear-gradient(135deg, #bb4a5b 0%, #8a425a 100%);
}
body.warm .header { background: #b55b43; }
body.warm .card-header { background: linear-gradient(135deg, #a8322b 0%, #d55 100%); }

.traffic-stat {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid rgba(244, 67, 54, 0.1);
}

.traffic-stat i {
    color: #f44336;
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.traffic-stat div {
    font-weight: 500;
    color: #333;
}

.map-container {
    height: 300px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Stock Styles */
.stock-info {
    background: linear-gradient(135deg, #f0fff4 0%, #dcfce7 100%);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(34, 197, 94, 0.1);
}

.stock-info h3 {
    color: #166534;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.stock-info p {
    margin-bottom: 0.5rem;
    color: #374151;
}

.stock-info .positive {
    color: #059669;
    font-weight: 600;
}

.stock-info .negative {
    color: #dc2626;
    font-weight: 600;
}

.chart-container {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 16px;
    padding: 1rem;
    height: 300px;
}

/* Stock Layout */
.stock-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.stock-info-section {
    min-height: 300px;
}

.stock-chart-section {
    min-height: 300px;
}

@media (max-width: 768px) {
    .stock-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chart-container {
        height: 250px;
    }
}

/* AI Summary Styles (default to cool) */
.ai-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

body.warm .ai-summary {
    background: linear-gradient(135deg, #e35d5b 0%, #d44a3c 100%);
}
.ai-summary::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    50% { transform: translate(-50%, -50%) rotate(180deg); }
}

.ai-summary h2 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.ai-summary p, .ai-summary .markdown-content {
    position: relative;
    z-index: 1;
    line-height: 1.7;
}

.ai-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-style: italic;
    opacity: 0.8;
}

.ai-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

/* Quote Styles */
.quote-card .card-content {
    text-align: center;
    padding: 2rem;
}

#quoteOfTheDay {
    font-style: italic;
    font-size: 1.1rem;
    color: white;
    line-height: 1.8;
}

#quoteOfTheDay h2 {
    color: #1e3c72;
    margin-bottom: 1.5rem;
    font-style: normal;
}

/* News Styles */
#newsContainer {
    margin-bottom: 1.5rem;
}

.loading-text {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.loading-text::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-radius: 50%;
    border-top-color: #666;
    animation: spin 1s ease-in-out infinite;
}

.news-item {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #1e3c72;
}

.news-item h3 {
    color: #1e3c72;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.news-item p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Settings Styles */
.settings-content {
    max-width: 1250px;
    margin: 0 auto;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: #374151;
    font-weight: 500;
}

.input-group label i {
    color: #1e3c72;
    width: 20px;
    text-align: center;
}

.input-group input {
    width: 100%;
    padding: 1.75rem 2.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    font-size: 1.2rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
    min-height: 72px;
}

.input-group input:focus {
    outline: none;
    border-color: #1e3c72;
    box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.1);
}

.input-group input::placeholder {
    color: #9ca3af;
}

/* AI Summary bullet point styling */
.ai-summary ul {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.ai-summary li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.ai-summary ol {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.ai-summary ol li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        border-radius: 0;
    }
    
    .main-content {
        padding: 1rem;
        gap: 1rem;
    }
    
    .card-content {
        padding: 1rem;
    }
    
    .header {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .header-left {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .app-title {
        font-size: 1.25rem;
    }
    
    .header-quote {
        font-size: 0.85rem;
        text-align: center;
    }
    
    .settings-btn {
        align-self: center;
    }
    
    .weather-grid {
        grid-template-columns: 1fr;
    }
    
    .traffic-info {
        grid-template-columns: 1fr;
    }
    
    .map-container {
        height: 250px;
    }
}

@media (min-width: 769px) {
    .main-content {
        grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    }
    
    .weather-card {
        grid-column: span 2;
    }
    
    .container {
        border-radius: 24px;
        margin: 1rem auto;
        min-height: calc(100vh - 2rem);
    }
}

@media (min-width: 1024px) {
    .main-content {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .weather-card {
        grid-column: span 4;
    }
    
    .traffic-card {
        grid-column: span 1;
    }
    
    .news-card {
        grid-column: span 3;
    }
    
    .stocks-card {
        grid-column: span 4;
    }
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Error States */
.error {
    color: #dc2626;
    background: #fef2f2;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #fecaca;
}

/* Success States */
.success {
    color: #059669;
    background: #f0fdf4;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #bbf7d0;
}

/* Hidden State */
.hidden {
    display: none !important;
}