/* General body and typography */
:root {
    --primary-color: #f97316; /* Vibrant Orange */
    --primary-hover-color: #ea580c;
    --background-color: #1f2937; /* Dark Slate Gray */
    --card-bg-color: #374151;
    --text-primary-color: #f3f4f6; /* Off-white */
    --text-secondary-color: #9ca3af;
    --border-color: #4b5563;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --danger-color: #ef4444;
    --font-family: 'Poppins', sans-serif;
    --border-radius: 8px;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    color: var(--text-primary-color);
    font-size: 16px;
}

/* Header bar */
.header-bar {
    background-color: var(--card-bg-color);
    color: var(--text-primary-color);
    padding: 1rem 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-bottom: 1px solid var(--border-color);
}
.header-content {
    max-width: 1200px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo-link {
    text-decoration: none;
    color: inherit;
}
.header-bar h1 {
    font-size: 1.75rem;
    margin: 0;
    font-weight: 700;
}
.main-nav {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75em 1.5em;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--border-radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-align: center;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.btn:hover, .btn:focus {
  transform: translateY(-2px);
  box-shadow: 0 7px 14px rgba(0,0,0,0.1), 0 3px 6px rgba(0,0,0,0.08);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover-color);
}

.btn-secondary {
  background: var(--card-bg-color);
  color: var(--text-primary-color);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background-color: #4b5563;
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}
.btn-danger:hover {
  background: #c53030;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}
.btn-outline:hover {
  background: var(--primary-color);
  color: white;
}

.btn-sm {
    padding: 0.4em 0.8em;
    font-size: 0.8rem;
}

/* Containers */
.container {
    max-width: 1200px;
    margin: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.admin-container {
    max-width: 1400px;
}
.content-panel, .winner-hero-card {
    background-color: var(--card-bg-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 900px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    box-sizing: border-box; /* Ensures padding doesn't affect width */
}

/* Forms */
.form-control, .search-form {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    color: var(--text-primary-color);
    box-sizing: border-box;
}
.form-inline { 
    display: flex; 
    gap: 1rem; 
    align-items: center; 
    margin-bottom: 1.5rem; 
}

.form-control:focus, .search-form:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.3);
}

.search-button {
    margin-top: 1rem;
    width: 100%;
}

/* --- Winner Hero Card --- */
.winner-hero-card {
    display: flex;
    flex-direction: row;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    padding: 0; /* Override default panel padding */
    overflow: hidden; /* Ensures the poster radius is respected */
}
.winner-poster {
    flex: 0 0 300px; /* Fixed width for the poster */
}
.winner-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.winner-details {
    padding: 2rem;
    display: flex;
    flex-direction: column;
}
.winner-badge {
    background-color: var(--primary-color);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    align-self: flex-start;
    margin-bottom: 1rem;
}
.winner-details h2 {
    margin: 0 0 0.5rem 0;
    font-size: 2.25rem;
    font-weight: 700;
    border-bottom: none;
}
.winner-submitter {
    font-size: 1rem;
    color: var(--text-secondary-color);
    margin-bottom: 1.5rem;
}
.winner-overview {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary-color);
}


/* --- Card container for "Recently Submitted" (NEW GRID LAYOUT) --- */
.card-container {
    display: grid;
    gap: 1rem;
    /* Default to 2 columns for a balanced mobile view */
    grid-template-columns: repeat(2, 1fr);
}

/* Small Movie Cards for "Recently Submitted" */
.movie-card-small {
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}
.movie-card-small:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}
.movie-card-small img {
    width: 100%;
    height: auto;
    aspect-ratio: 2/3; /* Maintain a movie poster aspect ratio */
    object-fit: cover;
    display: block;
}
.card-body-small {
    padding: 1rem;
    flex-grow: 1;
}
.card-title-small {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}


/* Flash messages */
.flash-container {
    width: 100%;
    max-width: 900px;
    margin-bottom: 1.5rem;
}
.flash {
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 600;
}
.flash-success {
    background-color: var(--success-color);
    color: white;
}
.flash-error {
    background-color: var(--error-color);
    color: white;
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
    .winner-hero-card {
        flex-direction: column;
    }
    .winner-poster {
        flex-basis: auto; /* Allow poster to resize */
        width: 100%;
        max-height: 400px; /* Constrain height on mobile */
    }
    .winner-details {
        padding: 1.5rem;
    }
    .winner-details h2 {
        font-size: 1.75rem;
    }
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Responsive grid for "Recently Submitted" */
@media (max-width: 480px) {
    /* 1 column on very small mobile screens (6 rows of 1) */
    .card-container {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) {
    /* 3 columns on tablets and medium screens (2 rows of 3) */
    .card-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- Dashboard Specific --- */
.dashboard-container { max-width: 1200px; margin: auto; padding: 2rem; }
.dashboard-header { text-align: center; margin-bottom: 3rem; }
.dashboard-header h2 { border-bottom: none; margin-bottom: 0.5rem; }
.dashboard-header p { color: var(--text-secondary-color); font-size: 1.1rem; }
.top-section { display: grid; grid-template-columns: 1fr; gap: 2rem; margin-bottom: 3rem; }
@media (min-width: 992px) {
    .top-section { grid-template-columns: 1fr 1fr; }
}

.stats-container, .badges-container { background-color: var(--card-bg-color); padding: 2rem; border-radius: var(--border-radius); border: 1px solid var(--border-color); }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.stat-card { background-color: var(--background-color); padding: 1.5rem; border-radius: var(--border-radius); text-align: center; }
.stat-card .value { font-size: 2.5rem; font-weight: 700; color: var(--primary-color); }
.stat-card .label { font-size: 0.9rem; color: var(--text-secondary-color); margin-top: 0.5rem; }

.badge-card-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.badge-card {
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border: 1px solid var(--border-color);
}
.badge-icon { font-size: 2.5rem; flex-shrink: 0; }
.badge-details { display: flex; flex-direction: column; }
.badge-title { font-size: 1.1rem; font-weight: 600; color: var(--text-primary-color); }
.badge-description { font-size: 0.9rem; color: var(--text-secondary-color); }

/* --- Tabs (Shared between Dashboard and Admin) --- */
.tabs { display: flex; border-bottom: 2px solid var(--border-color); margin-bottom: 2rem; flex-wrap: wrap;}
.tab-button {
    padding: 1rem 1.5rem;
    cursor: pointer;
    border: none;
    background-color: transparent;
    color: var(--text-secondary-color);
    font-size: 1rem;
    font-weight: 600;
    transition: color 0.2s, border-bottom 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}
.tab-button.active { color: var(--primary-color); border-bottom: 3px solid var(--primary-color); }

.tab-content { 
    display: none; 
}
.tab-content.active { 
    display: block; 
}

.empty-state { padding: 2rem; }

/* --- Admin & Other Specifics --- */
.admin-container h2 { border: none; text-align: center; }
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; }
.data-table th, .data-table td { padding: 0.75rem 1rem; border: 1px solid var(--border-color); text-align: left; }
.data-table thead { background-color: #4b5563; }
.data-table .actions { display: flex; gap: 0.5rem; align-items: center; }
.pagination { text-align: center; margin-top: 2rem; display: flex; justify-content: center; gap: 0.5rem;}
.danger-zone-actions { display: flex; flex-direction: column; gap: 1.5rem; }
.danger-action { 
    border: 1px solid var(--danger-color); 
    padding: 1.5rem; 
    border-radius: var(--border-radius); 
    background-color: var(--card-bg-color);
}
.primary-action {
    border: 1px solid var(--primary-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    background-color: var(--card-bg-color);
}
.edit-form .form-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
.admin-actions {
    margin-top: 2rem;
    border-top: 2px solid var(--border-color);
    padding-top: 2rem;
}
@media(min-width: 768px) { .edit-form .form-grid { grid-template-columns: 1fr 1fr; } }


/* --- Vote Page Specific --- */
.vote-container {
    width: 100%;
    max-width: 1400px;
}
.vote-header {
    text-align: center;
    margin-bottom: 2rem;
}
.vote-header h2 {
    border: none;
    font-size: 2rem;
}
.vote-header p {
    font-size: 1.1rem;
    color: var(--text-secondary-color);
}
.vote-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    padding-bottom: 100px; /* Space for the submit bar */
}
/* Find this existing rule in your styles.css */
/* 1. The .vote-card is now just a placeholder */
/* It holds the space in the grid and acts as a positioning parent. */
.vote-card {
    position: relative; /* Essential for positioning the child */
    cursor: pointer;
    /* We keep aspect-ratio to prevent the grid from collapsing if images are slow to load */
    aspect-ratio: 2/3; 
}

/* 2. Create the new content wrapper for all visual styles */
/* This element will pop out of the layout flow. */
.vote-card-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    
    display: flex;
    flex-direction: column;
    z-index: 1;
}

/* 3. Apply hover effects to the inner content, not the placeholder */
.vote-card:hover .vote-card-content {
    transform: scale(1.05); /* Increased scale slightly for better effect */
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    z-index: 10; /* Lifts the card on hover */
}

/* Keep the checkbox hidden */
.vote-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* The rest of your description rules are perfect and don't need to change! */
.vote-card-description {
    font-size: 0.85rem;
    color: var(--text-secondary-color);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    transition: all 0.4s ease-in-out;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.vote-card:hover .vote-card-description {
    -webkit-line-clamp: unset;
}
.vote-card-poster {
    position: relative;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transition: all 0.2s ease;
    overflow: hidden; /* Keep overlays contained */
}
.vote-card-poster img {
    width: 100%;
    display: block;
    aspect-ratio: 2/3;
    object-fit: cover;
}
.poster-placeholder {
    width: 100%;
    aspect-ratio: 2/3;
    background-color: var(--background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    font-weight: 600;
}
/* --- Overlays --- */
.selection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(249, 115, 22, 0.6); /* Orange overlay */
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.checkmark-icon {
    font-size: 4rem;
    color: white;
    font-weight: bold;
    transform: scale(0.5);
    transition: transform 0.2s ease;
}
/* --- Checkbox Logic --- */
/* Show the orange overlay when checked */
.vote-card input:checked ~ .vote-card-content .selection-overlay {
    opacity: 1;
}

/* Animate the checkmark icon when checked */
.vote-card input:checked ~ .vote-card-content .checkmark-icon {
    transform: scale(1);
}

/* Apply a border and glow to the ENTIRE card when checked */
.vote-card input:checked ~ .vote-card-content {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.5);
}
/* --- Vote Card Body --- */
.vote-card-body {
    padding: 1rem;
    flex-grow: 1; /* Ensure body takes up remaining space */
    display: flex;
    flex-direction: column;
}
.vote-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.vote-card-score {
    font-size: 0.9rem;
    color: var(--text-secondary-color);
    font-weight: 600;
    margin-top: auto; /* Push to the bottom */
}

/* --- Submit Bar --- */
.vote-submit-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--card-bg-color);
    padding: 1rem;
    text-align: center;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.3);
    border-top: 1px solid var(--border-color);
    z-index: 100;
}
.vote-submit-bar .btn {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
    font-size: 1.2rem;
}

