/* css/base.css */

/* -------------------------------------- */
/* 1. Variables                           */
/* -------------------------------------- */
:root {
    /* Background Colors */
    --bg-primary: #c0c2be;/*Parchment Paper */
    --bg-secondary: #ffffff; /* Crisp white for contrasting sections or headers */
    --bg-card: #ffffff; /* Pure white for cards, keeping content clear and bright */
    --body-bg-gradient-start: #C0C0C0; /* Start color for body radial gradient */
    --body-bg-gradient-end: #4B9CD3;   /* End color for body radial gradient */
    --input-bg: #add8e6; /* A very light blue for input fields */
    --story-item-overlay-gradient: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.6));
    --finance-button-bg-rgba: rgba(46, 52, 64, 0.4); /* Semi-transparent dark for finance buttons */

    /* Text Colors */
    --text-light: #5c4e42; /* A rich, deep brown for primary text */
    --text-dark: #8b7d6e; /* A softer, medium brown for secondary information */
    --link-color-dark: #00011f; /* Dark blue for general links */
    --white-text: #ffffff; /* Pure white for text on dark backgrounds */
    --text-shadow-black: 0 1px 0 black; /* General black text shadow */
    --finance-button-text-light: #add8e6; /* Light blue for finance button text */

    /* Accent Colors */
    --accent-blue: #ff9900; /* Orange for main accent, logo H1 */
    --accent-green: #a7c957; /* A brighter, more lively moss green for a happy touch */

    /* Button Colors */
    --button-bg: #8c7851; /* A warm, inviting terracotta-gold for buttons */
    --button-hover-bg: #746342; /* A deeper shade of the terracotta-gold on hover */
    --finance-button-active-gradient: linear-gradient(45deg, var(--accent-blue) 0%, var(--finance-button-text-light) 100%);
    --finance-button-active-shadow-1: rgba(106, 17, 203, 0.4);
    --finance-button-active-shadow-2: rgba(37, 117, 252, 0.4);
    --finance-button-active-border-gradient: linear-gradient(45deg, var(--finance-button-text-light), #425f75);

    /* Borders & Spacing */
    --border-color: #e0deda; /* A light, natural stone-like grey for borders */
    --card-border-radius: 8px;
    --spacing-unit: 1rem;
}

/* -------------------------------------- */
/* 2. Base & Reset                        */
/* -------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(var(--body-bg-gradient-start), var(--body-bg-gradient-end));
    color: var(--text-light);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--link-color-dark);
    font-weight: bold;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* -------------------------------------- */
/* 3. Layout                              */
/* -------------------------------------- */
.container {
    width: 90%;
    max-width: 1200px;
    justify-content: center;
    margin: 0 auto;
    padding: var(--spacing-unit) 0;
}

/* Header */
.header {
    padding: var(--spacing-unit) 0;
    top: 0; /* Not sticky, but good to keep relative positioning in mind */
    z-index: 1000;
    transition: padding 0.3s ease, height 0.3s ease;
    grid-area: header;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 60px;
    margin-right: 10px;
    transition: height 0.3s ease, margin-right 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-blue); /* Using variable */
    white-space: nowrap;
    transition: font-size 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

.logo p {
    font-size: 0.8rem;
    color: var(--text-dark);
    margin-left: 10px;
    transition: font-size 0.3s ease, margin-left 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

.nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

.nav a, .utility-icons a {
    color: var(--text-dark);
    font-weight: 500;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.nav a:hover, .utility-icons a:hover {
    color: var(--text-light);
    text-decoration: none;
}

.utility-icons {
    display: flex;
    gap: 1.2rem;
    font-size: 1.1rem;
}

/* Main Content Grid */
.main-content {
    flex-grow: 1;
    padding: calc(var(--spacing-unit) * 1.5) 0;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: calc(var(--spacing-unit) * 2);
    grid-template-areas:
        "header header header"
        "top-stories yt-video-player finance-card"
        "video-player-card prism-gallery ." 
        "social-card weather-card ."; 
}

/* Grid Area Assignments (using classes) */
.top-stories { grid-area: top-stories; }
.video-player-card { grid-area: video-player-card; }
.social-card { grid-area: social-card; }
.yt-video-player { grid-area: yt-video-player; }
.prism-gallery { grid-area: prism-gallery; }
.finance-card { grid-area: finance-card; }  
.weather-card-container { grid-area: weather-card; }

/* Left, Center, Right Column Margins (still apply to cards within them) */
.left-column .card,
.center-column .card,
.right-column .card {
    margin-bottom: var(--spacing-unit);
}

/* Footer */
.footer {
    padding: var(--spacing-unit) 0;
    text-align: center;
    grid-area: footer; /* Added grid area for footer */
}

.footer ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: var(--spacing-unit);
}

.footer a {
    color: var(--text-dark);
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--text-light);
    text-decoration: none;
}

.footer p {
    font-size: 0.8rem;
    color: var(--text-dark);
}

/* -------------------------------------- */
/* 4. Components                          */
/* -------------------------------------- */

/* Buttons */
.code-button,
.submit-button { /* Keeping them separate but sharing common styles */
    padding: 0; /* Corrected from 'none' */
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: var(--spacing-unit);
    border: none;
    border-radius: 0; /* Corrected from 'none' */
    display: flex; /* Changed from justify-content/align-items to display flex for more control */
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    background-color: transparent;
    transition: none; /* Consider adding a transition if desired later */
}

/* Card Styling */
.card {
    background: radial-gradient(var(--body-bg-gradient-start), var(--body-bg-gradient-end));
    border-radius: var(--card-border-radius);
    padding: var(--spacing-unit);
    margin-bottom: var(--spacing-unit);
}

.card h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: var(--spacing-unit);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    background-color: transparent; /* Corrected from 'none' */
}

.card-header h3 {
    font-size: 1.17rem;
    font-weight: 600;
    margin-bottom: var(--spacing-unit);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    background-color: transparent; /* Corrected from 'none' */
}

.card i {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: var(--spacing-unit);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text-dark);
    background-color: transparent; /* Corrected from 'none' */
}

.card h2 .icon {
    font-size: 1rem;
    color: var(--text-dark);
    cursor: pointer;
    text-decoration: none;
    background-color: transparent; /* Corrected from 'none' */
}

/* Social Buttons */
.social-item {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-unit);
    padding-bottom: var(--spacing-unit);
    border-bottom: 1px solid var(--border-color);
}
.social-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.social-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.social-item p {
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Top Stories */
.story-item {
    display: flex;
    height: 200px;
    width: 325px;
    margin-bottom: 10px;
    align-items: center;
    position: relative;
    /*border-bottom: 1px solid var(--border-color); /* Commented out based on original */
}
.story-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.story-item img {
    position: absolute;
    height: 200px;
    width: 325px;
    margin-right: 5px;
    top: 10px;
    object-fit: cover;
}

.story-item p {
    background: var(--story-item-overlay-gradient); /* Using variable */
    text-shadow: var(--text-shadow-black); /* Using variable */
    z-index: 100;
    position: absolute;
    color: var(--white-text); /* Using variable */
    font-size: 0.95rem;
    font-weight: 500;
    left: 15px;
    bottom: 2px;
}

/* Trending Now */
.trending-item {
    margin-bottom: var(--spacing-unit);
    padding-bottom: var(--spacing-unit);
    border-bottom: 1px solid var(--border-color);
}
.trending-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.trending-item h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 5px;
}
.trending-item p {
    font-size: 0.85rem;
    color: var(--text-dark);
}
.trending-item li {
    font-size: 0.85rem;
    margin-left: 10px;
    color: var(--text-dark);
}

.top-stories,
.social-card {
    width: 100%; /* Make these fill the width */
    max-width: 375px; /* Keep a max-width if desired for larger screens */
    margin-left: auto; /* Center them */
    margin-right: auto;
    }

.prism-gallery,
.yt-video-player {
    width: 100%; /* Make these fill the width */
    aspect-ratio: 16 / 9; /* Maintains a 16:9 aspect ratio for the card */
}

.yt-video-player iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

/* Finance Section */
.finance-card {
    width: 100%; /* Make these fill the width */
    max-width: 375px; /* Keep a max-width if desired for larger screens */
    height: 600px;
    margin-left: auto; /* Center them */
    margin-right: auto;
    margin-bottom: 5px;
    }

    .finance-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 5px;
    margin-top: 5px;
}

.finance-button {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--finance-button-text-light); /* Using variable */
    background: var(--finance-button-bg-rgba); /* Using variable */
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.finance-button i {
    font-size: 1.2em;
    line-height: 1;
}

.finance-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.finance-button.active {
    background: var(--finance-button-active-gradient); /* Using variable */
    color: var(--white-text);
    box-shadow: 0 5px 25px var(--finance-button-active-shadow-1), 0 5px 25px var(--finance-button-active-shadow-2); /* Using variables */
    transform: scale(1.05);
}

.finance-button.active::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    padding: 2px;
    background: var(--finance-button-active-border-gradient); /* Using variable */
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* -------------------------------------- */
/* 5. Utilities                           */
/* -------------------------------------- */
.tradingview-widget-container.hidden {
    display: none;
}

/* -------------------------------------- */
/* 6. Responsive Design                   */
/* -------------------------------------- */

/* Tablet and smaller desktops */
@media (max-width: 1349px) {
    .main-content {
        grid-template-columns: 1fr 2fr;
        grid-template-areas:
            "header header"
            "top-stories yt-video-player"
            "video-player-card prism-gallery"
            "social-card weather-card"
            "finance-card ." /* Adjusted to ensure finance-card takes full width if needed */
            "footer footer";
    }
}

/* Mobile and small tablets */
@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 1fr; 
        grid-template-areas:
            "header"
            "yt-video-player"
            "prism-gallery"
            "weather-card"
            "finance-card"
            "top-stories"
            "video-player-card"
            "social-card"
            "footer"  
    }
    
    .header-content {
        flex-direction: column;
        gap: var(--spacing-unit);
    }
    .nav ul {
        justify-content: center;
        flex-wrap: wrap;
    }
    .utility-icons {
        order: 0;
    }
    .logo {
        margin-bottom: var(--spacing-unit);
    }
    .container {
        width: 95%;
    }
    
    /* The original dimensions on these might be too large for a single column on mobile */
    .yt-video-player,
    .prism-gallery,
    .top-stories,
    .video-player-card,
    .weather-card-container { 
        width: 100%; /* Make these fill the width */
        max-width: 550px; /* Keep a max-width if desired for larger screens */
        margin-left: auto; /* Center them */
        margin-right: auto;
    }

    .finance-card {
        width: 100%; /* Make these fill the width */
        max-width: 550px; /* Keep a max-width if desired for larger screens */
        height: 600px;
        margin-left: auto; /* Center them */
        margin-right: auto;
    }

    .social-card {
       width: 100%; /* Make these fill the width */
        max-width: 185px; /* Keep a max-width if desired for larger screens */
        margin-left: auto; /* Center them */
        margin-right: auto; 
    }

    /* Top Stories - adjusting width for mobile view */
    .story-item {
        width: 100%; /* Make them fill the width */
        max-width: 325px; /* Keep original max-width if desired */
        margin-left: auto;
        margin-right: auto;
    }
    .story-item img {
        width: 100%;
    }
    .story-item p {
        left: var(--spacing-unit); /* Adjust positioning */
        right: var(--spacing-unit);
        bottom: calc(var(--spacing-unit) * 0.5);
    }

}
    /* Smaller mobile devices */
@media (max-width: 576px) {
     .main-content {
        grid-template-columns: 1fr; 
        grid-template-areas:
            "header"
            "yt-video-player"
            "prism-gallery"
            "weather-card"
            "finance-card"
            "top-stories"
            "video-player-card"
            "social-card"
            "footer";  
    }
    
  /* The original dimensions on these might be too large for a single column on mobile */
    .yt-video-player,
    .prism-gallery,
    .top-stories,
    .video-player-card,
    .weather-card-container { 
        width: 100%; /* Make these fill the width */
        max-width: 375px; /* Keep a max-width if desired for larger screens */
        margin-left: auto; /* Center them */
        margin-right: auto;
    }

    .finance-card {
        width: 100%; /* Make these fill the width */
        max-width: 375px; /* Keep a max-width if desired for larger screens */
        height: 600px;
        margin-left: auto; /* Center them */
        margin-right: auto;
    }

    .social-card {
       width: 100%; /* Make these fill the width */
        max-width: 375px; /* Keep a max-width if desired for larger screens */
        margin-left: auto; /* Center them */
        margin-right: auto; 
    }
    
    
    
    
    
    .logo h1 {
        font-size: 1.2rem;
    }
    .logo p {
        font-size: 0.7rem;
    }
    .nav a, .utility-icons a {
        font-size: 0.9rem;
    }

    .card h2 {
        font-size: 1.1rem;
    }
    .story-item p /*, .connect-item .text strong */ { /* connect-item commented out as it wasn't defined */
        font-size: 0.9rem;
    }
    
    .footer ul {
        flex-wrap: wrap;
        gap: 0.8rem;
    }
}