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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    padding: 0;
    background-color: #29244a;
    color: white;
    font-family: Arial, sans-serif;
    text-align: center;
    padding: 30px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    /* TV-safe area - prevent content from being cut off on TV screens */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Layout Elements */
.logo-container {
    margin-bottom: 30px;
    flex-shrink: 0;
}

.logo {
    width: 400px;
    height: auto;
    max-width: 100%;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.header-today {
    font-size: 80px;
    font-weight: bold;
    margin-bottom: 15px;
    line-height: 1.1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.company-name {
    font-size: 75px;
    font-weight: bold;
    margin-bottom: 15px;
    line-height: 1.1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.stock-text {
    font-size: 65px;
    font-weight: bold;
    color: #82ada6;
    margin-bottom: 12px;
    line-height: 1.1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.listed-text {
    font-size: 40px;
    font-weight: bold;
    margin-bottom: 5px;
    line-height: 1.1;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.exchange-text {
    font-size: 40px;
    font-weight: bold;
    margin-bottom: 12px;
    line-height: 1.1;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.is-text {
    font-size: 45px;
    font-weight: bold;
    margin-bottom: 25px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Price Box */
.price-container {
    background-color: white;
    border: 6px solid #2b748b;
    border-radius: 15px;
    padding: 35px 70px;
    margin: 35px auto;
    display: inline-block;
    min-width: 450px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    /* TV-safe: ensure box doesn't get cut off */
    max-width: calc(100vw - 40px);
}

.stock-price {
    font-size: 110px;
    font-weight: bold;
    color: #29244a;
    line-height: 1;
    min-height: 110px;
    transition: color 0.3s ease;
    font-variant-numeric: tabular-nums; /* Better number alignment */
    letter-spacing: -2px; /* Tighter spacing for large numbers */
}

.price-change {
    font-size: 28px;
    margin-top: 12px;
    font-weight: bold;
    color: #29244a;
    min-height: 33px;
    font-variant-numeric: tabular-nums;
}

.price-change.positive {
    color: #28a745;
}

.price-change.negative {
    color: #dc3545;
}

/* Loading Animation */
.loading {
    color: #82ada6;
    font-size: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.loading-dots::after {
    content: '.';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: ''; }
}

/* Update Pulse Animation */
.pulse {
    animation: pulse-animation 0.5s ease-in-out;
}

@keyframes pulse-animation {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Error State */
.stock-price.error {
    color: #dc3545;
    font-size: 40px;
}

/* Bottom Text */
.tomorrow-text {
    font-size: 65px;
    font-weight: bold;
    color: #82ada6;
    margin-top: 35px;
    margin-bottom: 8px;
    line-height: 1.1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.depends-text {
    font-size: 65px;
    font-weight: bold;
    line-height: 1.1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.you-emphasis {
    color: #d07052;
}

.last-updated {
    font-size: 18px;
    color: #82ada6;
    margin-top: 25px;
    opacity: 0.7;
    font-weight: 300;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Mobile (Portrait) - up to 480px */
@media (max-width: 480px) {
    body { 
        padding: 15px 10px; 
    }
    
    .logo { width: 250px; }
    
    .header-today, .company-name { font-size: 32px; }
    .stock-text, .tomorrow-text, .depends-text { font-size: 28px; }
    .listed-text, .exchange-text, .is-text { font-size: 18px; }
    
    .price-container { 
        min-width: auto; 
        width: 100%; 
        padding: 15px;
        border-width: 3px;
        margin: 20px 0;
    }
    
    .stock-price { font-size: 48px; min-height: 48px; letter-spacing: -1px; }
    .price-change { font-size: 18px; }
    .loading { font-size: 24px; }
    
    .last-updated { font-size: 14px; }
}

/* Mobile (Landscape) / Small Tablet - 481px to 768px */
@media (min-width: 481px) and (max-width: 768px) {
    body { padding: 20px 15px; }
    
    .logo { width: 300px; }
    
    .header-today, .company-name { font-size: 40px; }
    .stock-text, .tomorrow-text, .depends-text { font-size: 35px; }
    .listed-text, .exchange-text, .is-text { font-size: 20px; }
    
    .price-container { 
        min-width: auto; 
        width: 100%; 
        padding: 20px;
        border-width: 4px;
        margin: 20px 0;
    }
    
    .stock-price { font-size: 60px; min-height: 60px; }
    .price-change { font-size: 20px; }
    .loading { font-size: 30px; }
}

/* Tablet - 769px to 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    body { padding: 30px 20px; }
    
    .logo { width: 350px; }
    
    .header-today { font-size: 60px; }
    .company-name { font-size: 55px; }
    .stock-text, .tomorrow-text, .depends-text { font-size: 50px; }
    .listed-text, .exchange-text { font-size: 30px; }
    .is-text { font-size: 35px; }
    
    .price-container { 
        padding: 30px 50px;
        min-width: 400px;
    }
    
    .stock-price { font-size: 85px; min-height: 85px; }
    .price-change { font-size: 24px; }
}

/* Desktop - 1025px to 1920px */
@media (min-width: 1025px) and (max-width: 1920px) {
    /* Default styles apply - already optimized */
}

/* Large Desktop / Small TV - 1921px to 2560px */
@media (min-width: 1921px) and (max-width: 2560px) {
    body { padding: 50px 40px; }
    
    .logo { width: 500px; }
    
    .header-today { font-size: 100px; }
    .company-name { font-size: 95px; }
    .stock-text, .tomorrow-text, .depends-text { font-size: 80px; }
    .listed-text, .exchange-text { font-size: 50px; }
    .is-text { font-size: 55px; }
    
    .price-container { 
        padding: 50px 100px;
        min-width: 600px;
        border-width: 8px;
    }
    
    .stock-price { font-size: 140px; min-height: 140px; letter-spacing: -3px; }
    .price-change { font-size: 36px; }
    .last-updated { font-size: 24px; }
}

/* 4K TV / Ultra-wide - 2561px and above */
@media (min-width: 2561px) {
    body { padding: 80px 60px; }
    
    .logo { width: 700px; }
    
    .header-today { font-size: 140px; }
    .company-name { font-size: 130px; }
    .stock-text, .tomorrow-text, .depends-text { font-size: 110px; }
    .listed-text, .exchange-text { font-size: 70px; }
    .is-text { font-size: 75px; }
    
    .price-container { 
        padding: 70px 140px;
        min-width: 800px;
        border-width: 10px;
        border-radius: 20px;
    }
    
    .stock-price { font-size: 200px; min-height: 200px; letter-spacing: -4px; }
    .price-change { font-size: 50px; }
    .last-updated { font-size: 32px; }
}

/* TV-specific: Landscape orientation optimization */
@media (min-width: 1024px) and (orientation: landscape) {
    body {
        justify-content: center;
    }
    
    .price-container {
        margin: 40px auto;
    }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print styles (hide for TV/display use) */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .price-container {
        border: 2px solid black;
    }
}
