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

html, body{
    height: 100%;
    width: 100%;
    font-family: 'JetBrains Mono', monospace;
}

/* body{
    background-image: url('../assets/images/rain.jpg');
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: 100% 100%;
} */


/* Main container */
.weather-app {
    display: flex;
    width: 100%;
    min-height: 100vh;
    justify-content: space-between;

    background-size: 100% 100%;
    background-attachment: fixed;
    background-repeat: no-repeat;
    

    position: relative;   
    z-index: 0;           
}

/* Sidebar */
.sidebar{
    width: 25rem;
    display: flex;
    border-left:  1px solid black;
    flex-direction: column;
    align-items: center;
    background-color: rgba(30, 50, 120, 0.7); /* darker blue, better contrast */
    gap: 2rem;
    transition: 
    transform 0.4s ease,
    opacity 0.3s ease,
    width 0.4s ease,
    padding 0.4s ease;
    overflow: hidden;
}

.sidebar.no-bg {
  background-color: transparent; /* or 'unset' */
  border-left: none;              /* optional if you want it cleaner */
}

/* Search bar container */
.searchbar {
    margin-top: 5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.searchbar.no-bg{
    display: none;
}

/* Input field */
#place-search {
    background-color: rgba(255, 255, 255, 0.1); /* subtle translucent background */
    border: 1px solid rgba(255, 255, 255, 0.5); /* soft white border */
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
    width: 18rem;
    color: #ffffff; /* white text */
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
    backdrop-filter: blur(5px); /* frosted glass effect */
}

#place-search::placeholder {
    color: rgba(255, 255, 255, 0.7); /* lighter placeholder */
}

/* Input focus effect */
#place-search:focus {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #f5f5dc; /* beige border highlight */
    box-shadow: 0 0 10px rgba(245, 245, 220, 0.5);
}

/* Submit button */
#submitBtn {
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
    border: none;
    background: linear-gradient(to right, #4a6fa5, #7db9e8);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

#submitBtn:hover {
    background: linear-gradient(to right, #7db9e8, #4a6fa5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#submitBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

#place-search,
#submitBtn {
    font-family: 'JetBrains Mono', monospace;
}

/* Weather Info */
.weather-info{
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap:1rem;
    justify-content: space-between;
    transition: 
    opacity 0.35s ease,
    transform 0.35s ease,
    visibility 0.35s ease;
}

/* Weather Icon */
.weather-icon{
    width: 7rem;
    height: 7rem;
}

/* Location Info Box */
.location-info{
    border: 2px solid rgba(0, 0, 0, 0.241);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    background-color: rgba(30, 50, 120, 0.7); /* darker blue for better contrast */
    padding: 2rem;
    flex-direction: column;
}

.stats-left{
    display: flex;
    flex-direction: column;
}

/* Main weather stats container */
.weather-stats{
    border: 2px solid rgba(0, 0, 0, 0.241);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    background-color: rgba(30, 50, 120, 0.7);
    padding: 2rem;
    gap: 1rem;
}

/* Today's icon */
#todays-icon{
    align-self: center;
}

.temp{
    font-size: 3rem;
    color: #fffbf0; /* off-white for clarity */
}

.location-info span, .weather-stats span{
    color: white;
}

.country{
    font-size: 2rem;
}

/* Container for all 5-day forecast cards */
.stats-right {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Each day card */
.d1, .d2, .d3, .d4, .d5 {
    display: flex;
    flex-direction: column;   
    align-items: center;      
    background-color: rgba(25, 35, 70, 0.7); /* dark blue card */
    padding: 1rem;
    border-radius: 1rem;
    width: 6rem;             
    gap: 0.5rem;             
    transition: transform 0.2s, background-color 0.2s;
}

/* Hover effect for card */
.d1:hover, .d2:hover, .d3:hover, .d4:hover, .d5:hover {
    transform: translateY(-5px);
    background-color: rgba(50, 70, 150, 0.8);
}

/* Icon + day container */
.icon-day {
    display: flex;
    flex-direction: column;
    align-items: center;     
    gap: 0.25rem;            
}

/* Weather icon size */
.icon-day .weather-icon {
    width: 5rem;
    height: 5rem;
}

/* Day name style */
.icon-day .day {
    color: #fffbf0; /* off-white */
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;
}

/* Feels-like container: High, Low, Description */
.feels-like {
    display: flex;
    flex-direction: column;
    align-items: center;     
    gap: 0.2rem;
    font-size: 0.8rem;
}

/* Individual spans with better color distinction */
.feels-like .high {
    color: #ff6961; /* red-ish for high temp */
    font-weight: bold;
}

.feels-like .low {
    color: #1ecbe1; /* cyan for low temp */
    font-weight: bold;
}

.feels-like .desc {
    color: #f5f5dc; /* beige/off-white for description */
    font-style: italic;
}


.recent-news{
    color: #f1f1f1;
    align-self: flex-start;
    margin-left: 1rem;
}

.recent-news.no-bg{
    display: none;
}


/* News list container */
#news-section {
    list-style: none; /* remove bullets */
    padding: 0;
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* spacing between items */
    font-family: 'JetBrains Mono', monospace; /* consistent font */
    width: 100%;  /* make it respect sidebar width */
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.news-section.no-bg{
    display: none !important;
}

/* Individual news items */
#news-section li {
    background-color: rgba(0, 0, 0, 0.5); /* subtle dark card */
    color: white;
    padding: 0.6rem 0.8rem;
    border-radius: 0.8rem;
    overflow: hidden; /* hide overflow for scrolling text */
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* Link inside the item */
#news-section li a {
    text-decoration: none; /* remove underline */
    color: #f1f1f1;
    font-weight: 500;
    white-space: nowrap; /* keep text on a single line */
    display: inline-block;
    transition: transform 5s linear; /* smooth scroll effect */
}

/* Hover effect: scroll text left */
#news-section li:hover a {
    transform: translateX(-100%); /* move text left to reveal overflow */
}

/* Source/date info */
#news-section li span {
    display: block;
    font-size: 0.7rem;
    color: #ccc;
    margin-left: 0.5rem;
    flex-shrink: 0; /* prevent shrinking */
}

.btn-container{
    display: flex;
    gap: 0.5rem;
    justify-content: center;

}
.author{
    color: #f1f1f1;
}



/* The modal background */
.modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 100; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; 
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5); /* semi-transparent */
}

.sidebar .info{
    margin-top: auto;
}

/* Modal content box */
.modal-content {
  background-color: #fefefe;
  margin: 15% auto; /* Center vertically & horizontally */
  padding: 20px;
  border: 1px solid #888;
  max-width: 800px;  /* <-- change this to make it wider */
  width: 90%;        /* adjusts for smaller screens */
  border-radius: 8px;
  text-align: center;
}

/* Close button */
.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  cursor: pointer;
}
.close:hover {
  color: black;
}

#modal-text {
  white-space: pre-line; /* respects line breaks in textContent */
  line-height: 1.5;      /* optional: makes it more readable */
}




.hidden-ui {
  opacity: 0;
  transform: translateY(-20px) scale(0.98);
  visibility: hidden;
  pointer-events: none;
}


/* When hidden */
.sidebar.collapsed {
    transform: translateX(100%);
    opacity: 0;
    width: 0;
    padding: 0;
    border: none;
}


/* Info Buttons */
.more-info,
.hide-ui {
  padding: 0.7rem 1.4rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Glow border effect */
.more-info::before,
.hide-ui::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg, #7db9e8, #4a6fa5, #7db9e8);
  -webkit-mask: 
     linear-gradient(#000 0 0) content-box, 
     linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Hover */
.more-info:hover,
.hide-ui:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  background: rgba(255, 255, 255, 0.15);
}

.more-info:hover::before,
.hide-ui:hover::before {
  opacity: 1;
}

/* Click press */
.more-info:active,
.hide-ui:active {
  transform: scale(0.97);
}

/* ================= Mobile Styles ================= */
@media (max-width: 768px) {
    /* Weather app container: stack vertically */
    .weather-app {
        flex-direction: column;
        align-items: center;
        padding: 1rem;
    }

    /* Sidebar goes below weather info */
    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid black;
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }

    .sidebar.no-bg {
        border-top: none;
    }

    /* Weather stats: full width, stacked */
    .weather-stats {
        flex-direction: column;
        width: 100%;
        padding: 1rem;
    }

    /* Location info box: full width */
    .location-info {
        width: 100%;
        padding: 1rem;
    }

    /* Search bar: full width */
    .searchbar {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    #place-search {
        width: 100%;
    }

    #submitBtn {
        width: 100%;
    }

    /* 5-day forecast cards: wrap to multiple lines if needed */
    .stats-right {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .d1, .d2, .d3, .d4, .d5 {
        width: 45%; /* 2 per row on mobile */
        margin-bottom: 0.5rem;
    }

    /* Author text smaller */
    .author {
        font-size: 0.8rem;
        text-align: center;
    }

    /* Modal adjustments for mobile */
    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 1rem;
    }

    /* Buttons smaller and stacked */
    .btn-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .more-info, .hide-ui {
        width: 100%;
        font-size: 0.9rem;
    }

    /* News items smaller font */
    #news-section li {
        font-size: 0.85rem;
    }
}
