/* --- Base Setup --- */
:root {
  --theme-color: #ff6f91; /* Default theme color */
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    color: white;
    background-image: url('assets/backgrounds/sakura.jpg'); /* Default BG */
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    /* Allow header/footer to sit outside the container */
    display: flex;
    flex-direction: column;
}

/* --- NEW: Header Styles --- */
header {
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 50px;
    width: 100%;
    box-sizing: border-box; /* Ensures padding doesn't add to width */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
}

header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 2px 2px 5px #000;
}

.template-select-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.template-select-wrap label {
    font-weight: 600;
}

.template-select-wrap select {
  font-size: 1rem;
  font-family: 'Poppins', sans-serif;
  border-radius: 10px;
  border: 2px solid transparent;
  padding: 0.4em 0.8em;
  background-color: rgba(255, 255, 255, 0.9);
  color: #222;
  cursor: pointer;
}

/* --- Main Content Area --- */
#homescreen-container {
    display: flex;
    flex-wrap: wrap; /* Allows stacking on small screens */
    gap: 40px;
    padding: 50px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto; /* Center the main content */
    box-sizing: border-box;
    flex-grow: 1; /* Makes it fill the space before the footer */
}

/* --- Left Side (Tiles) --- */
.homescreen-left {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.tile {
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 30px 40px;
    text-align: center;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.tile h3 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
}

.tile:hover {
    transform: scale(1.03);
    border-color: var(--theme-color);
    box-shadow: 0 0 25px var(--theme-color);
}
/* Specific hover color for the main tile */
.tile:not(.coming-soon):hover {
    background-color: rgba(var(--theme-rgb), 0.2);
}

.tile.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
}
.tile.coming-soon span { font-size: 0.9rem; }
.tile.coming-soon:hover {
    transform: none;
    background-color: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* --- UPDATED: Right Side (Anime List) --- */
.homescreen-right {
    flex: 1;
    min-width: 300px;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 30px;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.homescreen-right h2 {
    margin-top: 0;
    text-align: center;
    font-size: 2.2rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.5);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.anime-list {
    overflow-y: auto; /* This makes the list scrollable! */
    padding-right: 10px; /* Space for the scrollbar */
}
/* Scrollbar styles */
.anime-list::-webkit-scrollbar { width: 8px; }
.anime-list::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
.anime-list::-webkit-scrollbar-thumb { background: var(--theme-color); border-radius: 4px; }

/* Styles for the loading/error messages */
.loading-text, .error-text {
    text-align: center;
    font-style: italic;
    opacity: 0.8;
    font-size: 1.1rem;
    padding-top: 20px;
}
.error-text { color: #ff8a80; }

/* Styles for each API-loaded anime item */
.anime-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 15px;
    transition: background-color 0.3s ease;
}
.anime-item:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.anime-rank {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-color);
    width: 50px;
    text-align: center;
    flex-shrink: 0;
}

.anime-item img {
    width: 50px;
    height: 70px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.anime-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    /* Allow text to wrap */
    min-width: 0;
}

.anime-details h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    /* Handle long titles */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.anime-score {
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.9;
}


/* --- NEW: Footer Styles --- */
footer {
    width: 100%;
    text-align: center;
    padding: 20px 50px;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
    margin-top: auto; /* Pushes footer to the bottom */
}
footer p {
    margin: 0;
    opacity: 0.7;
}


/* --- THEME DEFINITIONS ---
   Copied from task-planner.css so themes work on the homepage
*/
body.template-default { --theme-color: #e11584; --theme-rgb: 255, 135, 192; background-image: url('assets/backgrounds/homescreen-bg.jpeg'); }
body.template-sakura-pink { --theme-color: #ff87c0; --theme-rgb: 255, 135, 192; background-image: url('assets/backgrounds/sakura.jpg'); }
body.template-one-piece { --theme-color: #39a2db; --theme-rgb: 57, 162, 219; background-image: url('assets/backgrounds/one-piece.avif'); }
body.template-jujutsu-kaisen { --theme-color: #e53935; --theme-rgb: 229, 57, 53; background-image: url('assets/backgrounds/jujutsu-kaisen.jpeg'); }
body.template-demon-slayer { --theme-color: #4db6ac; --theme-rgb: 77, 182, 172; background-image: url('assets/backgrounds/demon-slayer.jpeg'); }
body.template-mount-fuji { --theme-color: #a7c7e7; --theme-rgb: 167, 199, 231; background-image: url('assets/backgrounds/mount-fuji.jpg'); }

/* Apply theme colors to header */
body.template-sakura-pink header { background-color: rgba(255, 135, 192, 0.2); }
body.template-one-piece header { background-color: rgba(57, 162, 219, 0.2); }
body.template-jujutsu-kaisen header { background-color: rgba(229, 57, 53, 0.2); }
body.template-demon-slayer header { background-color: rgba(77, 182, 172, 0.2); }
body.template-mount-fuji header { background-color: rgba(167, 199, 231, 0.2); }