/* static/css/style.css - CORRECTED */

/* ========================================= */
/*  1. ROOT VARIABLES & GLOBAL RESETS        */
/* ========================================= */
:root {
    --primary-color: #f9cb28;
    --background-start: #0f0c29;
    --background-mid: #302b63;
    --background-end: #24243e;
    --card-bg: rgba(30, 30, 50, 0.4);
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --sidebar-bg: rgba(15, 12, 41, 0.9);
    --border-color: rgba(255, 255, 255, 0.1);
    --success-color: #28a745;
    --error-color: #dc3545;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--background-start), var(--background-mid), var(--background-end));
    color: var(--text-color);
    display: flex;
    height: 100vh;
    overflow: hidden; /* Prevent body scrollbars */
}

h1, h2, h3, h4 {
    color: var(--primary-color);
    font-weight: 600;
    margin: 0;
    /* font-size: clamp(1.5rem, 4vw, 2.2rem); */
    font-size: 1.5rem; /* Default size, can be overridden in specific sections */
}

p {
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* ========================================= */
/*  2. MAIN LAYOUT & SIDEBAR                 */
/* ========================================= */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 2rem;
}

.sidebar-header h2 {
    font-size: 1.5rem;
}

.tabs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.tab-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    text-align: left;
    transition: background-color 0.2s, color 0.2s;
}

.tab-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.tab-link.active {
    background-color: var(--primary-color);
    color: var(--background-start);
    font-weight: 600;
}

.tab-link.active svg {
    stroke: var(--background-start);
}

.sidebar-options {
    margin-top: 2rem;
}

.slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#cols-slider {
    flex-grow: 1;
}

.sidebar-footer {
    margin-top: auto;
    font-size: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-family: 'Segoe UI', sans-serif;
    font-weight: 500 ;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Key for child scrolling */
}

.main-head {
    padding: 0rem 0rem;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--background-start), var(--background-mid), var(--background-end));
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

/* .main-head h1 { */
    /* font-size: clamp(1.5rem, 4vw, 2.2rem); Responsive font size */
    /* font-size: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    
} */

/* .main-head p{
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    max-width: 600px;
    text-align: center;
    color:  #fff;
    justify-content:center ;

} */
 .main-head {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color:var(--primary-color);
    text-align: center;
}

.sub-head {
    font-size: .9rem;
    font-weight: 100;
    color: white;
    text-align: center;
    margin-bottom: 1.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}


.tab-content {
    display: none;
    flex-grow: 1; /* Allow tab content to fill space */
    overflow-y: auto; /* Each tab content scrolls independently */
    padding: 0 3rem 2rem 3rem;
}

.tab-content.active {
    display: flex; /* Use flex to manage layout inside the tab */
    flex-direction: column;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================= */
/*  3. CHAT TAB STYLES                       */
/* ========================================= */
.chat-interface {
    display: flex;
    flex-direction: column;
    height: 100%; /* Fill the parent tab content area */
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

#chat-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

#chat-input-area form {
    display: flex;
    flex-direction: row;
    align-items: flex-end; /* Align to bottom for multiline text */
    gap: 1rem;
    max-width: 100%;
}

.textarea-wrapper {
    position: relative;
    flex-grow: 1;
}

#text-query-input {
    width: 100%;
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 0.75rem 50px 0.75rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    resize: none; /* Let JS handle resizing */
    max-height: 150px; /* Prevent it from getting too tall */
    overflow-y: auto;
}

#inspire-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    color: var(--primary-color);
    width: 32px;
    height: 32px;
}

#chat-input-area .submit-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Chat Bubbles */
.chat-message {
    padding: 1rem 1.5rem;
    border-radius: 18px;
    max-width: 85%;
    line-height: 1.6;
}

.chat-message.user {
    background: var(--primary-color);
    color: var(--background-start);
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.chat-message.assistant {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.chat-message .chat-text-content {
    margin-bottom: 1rem; /* Space between text and cards */
}
.chat-message .chat-text-content:last-child {
    margin-bottom: 0;
}

/* ======================================================= */
/*  4. CONTEXTUAL MOVIE CARD STYLES (THE IMPORTANT FIX)    */
/* ======================================================= */

/* --- A. Base Card Style (shared properties) --- */
.movie-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.movie-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

/* --- B. Style for Cards in the Poster Grid (#image-tab) --- */
#image-results-container {
    display: grid;
    /* This creates a responsive grid without media queries! */
    grid-template-columns: repeat(var(--grid-cols, 3), 1fr);
    gap: 1.5rem;
    padding-top: 1rem;
}

#image-results-container .movie-card {
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 2 / 3; /* Maintain movie poster aspect ratio */
}

#image-results-container .poster-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#image-results-container .card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1rem 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 20%, transparent);
    transform: translateY(65%);
    transition: transform 0.4s ease-out;
}

#image-results-container .movie-card:hover .card-content {
    transform: translateY(0);
}

/* --- C. Style for Cards in the Chat (#text-tab) --- */
.chat-results-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.chat-results-container .movie-card {
    display: flex; /* Arrange horizontally */
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 10px;
    max-width: 500px;
}

.chat-results-container .poster-img {
    width: 60px;
    height: 90px; /* 2:3 aspect ratio */
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.chat-results-container .card-content {
    flex-grow: 1;
    /* We don't need the complex hover reveal here */
}

.chat-results-container .card-content h4 {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.chat-results-container .card-explanation {
    font-size: 0.85rem;
    color: var(--text-muted);
    /* Limit explanation to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-actions a {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.75rem;
}

/* ========================================= */
/*  5. FORMS & UTILITIES                     */
/* ========================================= */
.submit-btn {
    background: linear-gradient(90deg, #ff4d4d, var(--primary-color));
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 1rem;
    /* Added to center the spinner */
    display: flex;
    align-items: center;
    justify-content: center;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(249, 203, 40, 0.4);
}

.submit-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* THIS IS THE CORRECT, WORKING SPINNER STYLE */
.spinner {
    display: inline-block;
    width: 1.5em; /* Increased size slightly for better visibility */
    height: 1.5em;
    border: 0.2em solid rgba(255, 255, 255, 0.7);
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

#image-tab form {
    max-width: 700px;
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.file-uploader-label {
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
}

input[type="file"] {
    display: none;
}

.skeleton-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    aspect-ratio: 2 / 3;
    position: relative;
    overflow: hidden;
}

.skeleton-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 150%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% { left: 150%; }
}

/* ========================================= */
/*  6. RESPONSIVENESS                        */
/* ========================================= */
@media (max-width: 1024px) {
    body {
        flex-direction: column;
        overflow: auto;
    }
    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        padding: 0.5rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .sidebar-header h2 { font-size: 1.2rem; }
    .tabs { flex-direction: row; margin: 0 1rem; }
    .sidebar-options, .sidebar-footer { display: none; }
    .main-content { padding: 0; }
    .main-header { padding: 1.5rem; }
    .tab-content { padding: 0 1.5rem 1.5rem 1.5rem; }
}

@media (max-width: 768px) {
    #image-results-container {
        /* On mobile, use the slider value, but default to 2 cols */
        grid-template-columns: repeat(var(--grid-cols, 2), 1fr);
    }
}

/* --- ALL THE CONFLICTING CSS BELOW THIS LINE HAS BEEN REMOVED --- */

.marquee-container {
    height: 42px;
    overflow: hidden;
    position: relative;
    background: rgba(15, 12, 41, 0.8);
    border-radius: 10px;
    border: 1px solid rgba(249, 203, 40, 0.3);
    box-shadow: 0 0 12px rgba(249, 203, 40, 0.1);
    backdrop-filter: blur(6px);
    padding-left: 10px;
    margin-bottom: 1.5rem;
}

.marquee-text {
    position: absolute;
    width: 100%;
    height: 100%;
    margin: 0;
    line-height: 42px;
    font-size: 15px;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 500;
    background: linear-gradient(90deg, #f9cb28, #ff9d00, #f9cb28);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 8px rgba(249, 203, 40, 0.3);
    animation: scrollLeft 20s linear infinite;
}

@keyframes scrollLeft {
    0%   { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}
.logo-container img {
    width: auto;
    height: 250px;
    display: block;
    margin: 0 auto;
}
.main-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(15, 12, 41, 0.9);
    border-top: 1px solid var(--border-color);
}
.footer p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.footer a {
    color: var(--primary-color);
    text-decoration: none;
}
.footer a:hover {
    text-decoration: underline;
}
.footer a:visited {
    color: var(--primary-color);
}
.footer a:active {
    color: var(--primary-color);
}
.footer a:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(249, 203, 40, 0.5);
}

.flag-wrapper {
  perspective: 1000px;
  display: inline-block;
}

.notice-board {
  background: linear-gradient(135deg, #ffe082, #ffca28);
  clip-path: polygon(0 0, 100% 0, 95% 100%, 5% 100%);
  padding: 16px 20px;
  margin: 20px;
  border: 2px solid #f57f17;
  color: #333;
  font-family: 'Segoe UI', sans-serif;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  max-width: 300px;
  animation: flag-wave 3s ease-in-out infinite;
  transform-origin: top center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}


.notice-board h3 {
    margin-top: 0;
    font-size: 1.1em;
    color: #bf360c;
}

.notice-board a {
    color: #d84315;
    font-weight: bold;
    text-decoration: underline;
}

.notice-board a:hover {
    color: #880e4f;
}
.notice-board p {
    margin: 8px 0;
    line-height: 1.4;
    color: #000;
}
.notice-board ul {
    padding-left: 20px;
    margin: 8px 0;
}

.notice-board:hover {
    transform: translateY(0);
}
@keyframes flag-wave {
  0%   { transform: rotateX(0deg); }
  20%  { transform: rotateX(6deg); }
  40%  { transform: rotateX(-6deg); }
  60%  { transform: rotateX(4deg); }
  80%  { transform: rotateX(-3deg); }
  100% { transform: rotateX(0deg); }
}

