/*
=================================================================
Tailwindish Modern CSS - Enhanced from base template
Author: Gemini (Modified)
Description: Universal dark theme with a special login page style.
=================================================================
*/

/* --- Add to the top of style.css --- */

/* Inter Variable (Normal) */
@font-face {
  font-family: 'Inter';
  font-style:  normal;
  font-weight: 100 900; /* Defines the available weight range */
  font-display: swap;
  src: url("./fonts/Inter/Inter-VariableFont_opsz,wght.ttf") format("truetype");
}

/* Inter Variable (Italic) */
@font-face {
  font-family: 'Inter';
  font-style:  italic;
  font-weight: 100 900; /* Defines the available weight range */
  font-display: swap;
  src: url("./fonts/Inter/Inter-Italic-VariableFont_opsz,wght.ttf") format("truetype");
}


/* Your existing :root selector should be below this */
:root {
    --primary-color: #3b82f6;
    /* ...etc */
}

/* --- 1. Variables & Global Resets --- */
:root {
    --primary-color: #3b82f6;
    --primary-hover-color: #2563eb;
    --secondary-color: #6b7280;
    --background-color: #0c0a18; /* Dark theme default */
    --surface-color: #ffffff; /* Kept for reference, but dark theme uses rgba */
    --text-color: #cbd5e1; /* Dark theme default */
    --border-color: rgba(255, 255, 255, 0.1); /* Dark theme default */
    --success-color: #10b981;
    --success-bg-color: rgba(16, 185, 129, 0.1);
    --success-border-color: rgba(16, 185, 129, 0.5);
    --danger-color: #ef4444;
    --danger-bg-color: rgba(239, 68, 68, 0.1);
    --danger-border-color: rgba(239, 68, 68, 0.5);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --border-radius: 0.5rem;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.2s ease-in-out;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(-45deg, #0f0c29, #1e3a8a, #302b63, #0c1e3c);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- 2. Typography --- */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; color: #fff; } /* Default h2 to white for dark bg */
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }

p { margin-bottom: 1rem; }

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}
a:hover {
    color: var(--primary-hover-color);
    text-decoration: underline;
}

img, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

hr {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 2rem 0;
}

/* --- 3. Layout --- */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}
.header-flex { display: flex; justify-content: space-between; align-items: center; padding: 0 !important; }


/* --- 4. Header & Navigation (Dark Theme Default) --- */
.main-header {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

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

.main-nav a:not(.btn) {
    font-weight: 500;
    color: #94a3b8;
    padding: 0.5rem;
    text-decoration: none;
}
.main-nav a:not(.btn):hover,
.main-nav a:not(.btn).active {
    color: #60a5fa;
    text-decoration: none;
}

.username {
    font-weight: 600;
    color: #fff;
}

/* --- 5. Grid Layout & Cards (Dark Theme Default) --- */
.widget-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(3, 1fr);
}
@media (min-width: 1024px) { .widget-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 768px) { .widget-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .widget-grid { grid-template-columns: 1fr; } }

.card {
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    color: #cbd5e1;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    position: relative;
    display: flex;
    flex-direction: column;
}

.widget-grid .card {
    min-height: 200px;
    max-height: 300px;
    overflow: hidden;
}

/* --- FIX for YouTube Widget Card --- */
.widget.youtube-widget {
    max-height: none; /* Allow this card to grow to fit the video */
    padding-bottom: 0;
}

.card-title {
    margin-top: 0;
    color: #60a5fa;
}

.card-content {
    overflow: hidden;
    text-overflow: ellipsis;
    /* max-height: 100px; */ /* Removed to allow content to flex */
    line-height: 1.5em;
    position: relative;
    flex-grow: 1; /* Allow content to fill space */
}
.card-content a {
    color: #93c5fd;
    font-weight: 500;
}
.card-content a:hover {
    color: #bfdbfe;
}
.card .overlay-link {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color var(--transition-speed);
    z-index: 10;
}
.card .overlay-link:hover {
    background-color: var(--primary-hover-color);
}

/* --- Styles for YouTube Video and Copy button --- */
.youtube-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.widget-actions {
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.btn-copy-link {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

.btn-copy-link:hover {
    background-color: #5a626b; /* Darker shade of secondary color */
}

.btn-copy-link:disabled {
    background-color: var(--success-color);
    cursor: default;
    opacity: 1;
}


/* --- 6. Forms (Dark Theme Default) --- */
.form-group { margin-bottom: 1.5rem; }
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: var(--font-family);
    color: #e2e8f0;
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}
textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* --- 7. Buttons --- */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed);
    user-select: none;
}
.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-hover-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}
.btn-remove {
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: color var(--transition-speed);
}
.btn-remove:hover {
    color: var(--danger-color);
}

/* --- 8. Footer (Dark Theme Default) --- */
.main-footer {
    background-color: transparent;
    color: #94a3b8;
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}
.main-footer a { color: #60a5fa; }
.main-footer a:hover { color: #93c5fd; }

/* --- 9. Utility Classes (Remain unchanged) --- */
.text-center { text-align: center; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mt-1 { margin-top: 1rem; }

/* --- 10. Media Queries --- */
@media (max-width: 992px) {
    .widget-setup-container {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    html { font-size: 15px; }
    .container { width: 95%; }
    .header-flex { flex-direction: column; gap: 1rem; padding: 1rem !important; }
    .main-nav ul { flex-direction: column; align-items: center; gap: 0.5rem; }
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
}

/* --- 11. Tables (Dark Theme Default) --- */
.table-wrapper {
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow-x: auto;
}
.professional-table {
    width: 100%;
    border-collapse: collapse;
}
.professional-table th, .professional-table td {
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    text-align: left;
}
.professional-table th {
    background-color: rgba(30, 41, 59, 0.5);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}
.professional-table tbody tr:nth-child(even) {
    background-color: rgba(30, 41, 59, 0.2);
}
.professional-table tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.2);
}
.table-controls {
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    color: #cbd5e1;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.table-controls span {
    font-weight: 600;
    color: #fff;
}
.table-controls a {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    background-color: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    transition: all var(--transition-speed);
}
.table-controls a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}
.table-controls a.active {
    background-color: #60a5fa;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.sort-icon { color: white; }
.table-controls a:not(.active) .sort-icon { color: #60a5fa; }

/* --- 12. Standalone Login Page Styles --- */
/* This class on <body> overrides the dark theme defaults */
.login-page {
    background-color: #0c0a18;
    color: #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.login-page .background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0; /* Behind login card */
    background: linear-gradient(-45deg, #0f0c29, #1e3a8a, #302b63, #0c1e3c);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
}

.login-page .login-container {
    width: 100%;
    max-width: 480px;
    padding: 2rem;
    position: relative; 
    z-index: 1;
}

.login-page .login-card {
    background: rgba(17, 24, 39, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 3rem 2.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    text-align: center;
}

.login-page .logo {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: text-glow 2s ease-in-out infinite alternate;
}

@keyframes text-glow {
    from { text-shadow: 0 0 10px #3b82f6, 0 0 20px #60a5fa; }
    to { text-shadow: 0 0 20px #3b82f6, 0 0 30px #60a5fa; }
}

.login-page .card-subtitle {
    margin-bottom: 2rem;
    color: #94a3b8;
}

.login-page .input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.login-page .input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #94a3b8;
    pointer-events: none;
}

.login-page .form-control {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 3rem;
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}
.login-page .form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
}

.login-page .btn-submit {
    width: 100%;
    padding: 0.85rem 1rem;
    background: #3b82f6;
    border: none;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.login-page .btn-submit:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.login-page .login-err-msg {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-page .signup-link {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: #94a3b8;
}

.login-page .signup-link a {
    color: #60a5fa;
    font-weight: 600;
    text-decoration: none;
}
.login-page .signup-link a:hover {
    text-decoration: underline;
}

/* --- 14. Popup Modal Styles (Dark Theme Default) --- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.popup-overlay.is-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}
.popup-box {
    position: relative;
    padding: 2rem;
    width: 90%;
    max-width: 800px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.popup-box pre {
    white-space: pre-wrap;
    word-wrap: break-word;
}
.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #94a3b8;
}
.close-btn:hover {
    color: #fff;
}

/* --- 15. Pagination Styles --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 0 1rem;
}
.pagination a {
    color: #cbd5e1;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed);
}
.pagination a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}
.pagination a.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    font-weight: 600;
}

/* --- 16. Widget Setup Page Styles --- */
.widget-setup-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}
.your-widgets-column .card, .available-widgets-column .card {
    height: 100%;
}
.widgets-to-manage {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.widget-config-item {
    padding: 1rem;
    background-color: rgba(30, 41, 59, 0.5);
    transition: background-color 0.3s ease; /* Added for smooth transition */
    border: 1px solid var(--border-color); /* Added for consistency */
}
.config-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.config-item-header h4 {
    margin-bottom: 0;
    color: #e2e8f0;
}
.available-widget-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.available-widget-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: rgba(30, 41, 59, 0.5);
    transition: background-color var(--transition-speed);
}
.available-widget-card:hover {
    background-color: rgba(51, 65, 85, 0.7);
}
.widget-info h4 {
    margin-bottom: 0.25rem;
}
.widget-description {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 0;
}
.widget-add form {
    margin: 0;
}

/* --- NEW: Keyframes for highlight effect --- */
@keyframes highlight-fade {
    from {
        background-color: rgba(59, 130, 246, 0.3);
        border-color: var(--primary-color);
    }
    to {
        background-color: rgba(30, 41, 59, 0.5);
        border-color: var(--border-color);
    }
}

/* --- NEW: Style for the highlighted widget --- */
.widget-config-item.highlighted {
    animation: highlight-fade 2.5s ease-out forwards;
}


/* --- 17. Alert & Flash Message Styles --- */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    font-weight: 500;
}
.alert-success {
    color: var(--success-color);
    background-color: var(--success-bg-color);
    border-color: var(--success-border-color);
}
.alert-danger {
    color: var(--danger-color);
    background-color: var(--danger-bg-color);
    border-color: var(--danger-border-color);
}
/* style.css */
.order-input {
    width: 100px;
}

.text-white {
    color: #fff;
}

/* --- Styles for RR Page Video (Final Layout Fix) --- */
body.rr-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Ensures body is at least as tall as the screen */
}

body.rr-page main.container {
    flex-grow: 1; /* This is the key: tells the main content to grow and fill all available space */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

body.rr-page .video-wrapper {
    max-width: 100%;
    max-height: 100%;
}

body.rr-page video {
    width: 100%;
    height: 100%;
    /* This ensures the video scales within its container while keeping its aspect ratio */
    object-fit: contain; 
    max-height: calc(100vh - 160px); /* A safe max-height to account for header/footer */
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

/* --- 18. Imageinator Styles --- */
.generated-image {
    border-radius: var(--border-radius);
    margin-top: 1rem;
    max-width: 100%; /* Make it responsive */
    height: auto;
    max-height: 768px; /* Prevent huge images */
    margin-left: auto;
    margin-right: auto;
    display: block;
}

@media (min-width: 576px) {
    .generated-image {
        max-width: 512px;
    }
}



/* --- 20. Chat Message Enhancements --- */

/* Updated padding to give the form more vertical space */
#chat-form-container {
    padding: 1.2rem 1.5rem;
}

/* Main container for a single message (name + bubble) */
.chat-message {
    display: flex;
    flex-direction: column; /* Stack name on top of bubble */
    max-width: 80%;
}

/* Style for the sender's name */
.sender-name {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #94a3b8; /* A neutral, soft color */
}

/* The message bubble itself */
.message-content {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    line-height: 1.5;
    white-space: pre-wrap; /* Preserve line breaks */
    border: 1px solid var(--border-color); /* This adds the outline */
}

/* Align the user's entire message block to the right */
.user-message {
    align-self: flex-end;
    align-items: flex-end; /* Align text inside to the right */
}

.user-message .sender-name {
    color: #60a5fa; /* Make user's name stand out */
}

/* Align the AI's entire message block to the left */
.assistant-message {
    align-self: flex-start;
    align-items: flex-start; /* Align text inside to the left */
}

#send-button {
    position: relative;
    top: 10px; /* Nudges the button down slightly to align perfectly */
}

/* --- 21. Chat History Layout --- */
.page-wrapper {
    display: flex;
    height: calc(100vh - 80px); /* Adjust based on header height */
}

.conversation-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: rgba(17, 24, 39, 0.4);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.new-chat-btn {
    width: 100%;
    text-align: center;
}

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.conversation-list a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    color: var(--text-color);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: rgba(255, 255, 255, 0.05);
    transition: background-color var(--transition-speed);
}

.conversation-list a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.conversation-list a.active {
    background-color: var(--primary-color);
    color: #fff;
    font-weight: 600;
}

.chat-main-area {
    flex-grow: 1;
    padding: 0;
    display: flex;
    justify-content: center;
}

.chat-main-area .chat-container {
    padding: 2rem;
    width: 100%;
    max-width: 900px;
    height: 100%;
}

/* --- 22. Full Page Chat Layout Fixes --- */

/* Apply a flex column layout to the body for the chat page */
body.full-page-chat {
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* REMOVED overflow: hidden; which was disabling all scrollbars */
}

/* Ensure the header stays at the top */
body.full-page-chat .main-header {
    flex-shrink: 0;
}

/* Make the .page-wrapper fill the remaining vertical space */
body.full-page-chat .page-wrapper {
    flex-grow: 1;
    min-height: 0; /* Important flexbox fix for overflow */
}

/* Widen the chat area */
.chat-main-area .chat-container {
    max-width: 1200px; /* Increased max-width */
}

/* --- 23. Delete Conversation Button Styles (Corrected) --- */

.conversation-item {
    position: relative; /* This is the anchor for the absolute button */
}

.conversation-link {
    display: block;
    width: 100%; /* Ensures the link takes up the full width */
    padding: 0.75rem 1rem;
    /* Add extra padding on the right to prevent text from overlapping the button */
    padding-right: 2.5rem; 
    border-radius: var(--border-radius);
    color: var(--text-color);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: rgba(255, 255, 255, 0.05);
    transition: background-color var(--transition-speed);
}

.conversation-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.conversation-link.active {
    background-color: var(--primary-color);
    color: #fff;
    font-weight: 600;
}

.delete-btn {
    /* Position the button on top of the link */
    position: absolute;
    right: 5px; /* 5px buffer from the right edge */
    top: 50%; /* Center vertically */
    transform: translateY(-50%); /* Fine-tune vertical centering */
    
    /* Styling */
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 1rem;
    padding: 0.25rem;
    opacity: 0; /* Hide the button by default */
    transition: opacity 0.2s, color 0.2s;
}

/* Show the delete button when hovering over the entire item */
.conversation-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    color: var(--danger-color);
}

.mute-btn svg {
    width: 24px;
    height: 24px;
}

/* --- 25. Chat Area Width Adjustment --- */
body.full-page-chat .chat-main-area.container {
    /* Overrides the default container width for the chat page */
    max-width: 1600px;
    width: 95%;
}

/* --- 26. Football Squares Table Styles (Final) --- */
.football-squares-table th,
.football-squares-table td {
    text-align: center;
    vertical-align: middle;
    padding: 0.25rem;
    font-size: clamp(0.5rem, 1vw, 0.7rem);
    border-width: 4px; /* Doubled border size */

    /* --- Sizing for Perfect Squares --- */
    width: 2.5vw;
    height: 2.5vw;
    min-width: 32px;
    min-height: 32px;
    max-width: 56px;
    max-height: 56px;
}

.football-squares-table th {
    font-size: clamp(0.8rem, 2vw, 1.25rem);
    font-weight: 700;
}

/* This disables the default row hover from the main stylesheet */
.football-squares-table tbody tr:hover {
    background-color: transparent;
}

.football-squares-table .corner-cell {
    /* This cell is intentionally left blank */
}

.football-squares-table .open-cell {
    color: var(--secondary-color);
    font-style: italic;
}

/* --- 27. RSS Feed Display Styles --- */
.rss-grid {
    display: grid;
    grid-template-columns: 1fr; /* Default to a single column */
    gap: 1.5rem;
}

/* On larger screens, show two columns */
@media (min-width: 768px) {
    .rss-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.rss-grid .card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.rss-grid .card-title a {
    color: var(--primary-color);
}

.rss-grid .card-title a:hover {
    color: var(--primary-hover-color);
    text-decoration: none;
}

/* --- 28. RSS Card Image Styles --- */
.rss-item-image {
    width: 100%;
    height: 180px;
    object-fit: cover; /* This crops the image to fit the dimensions without stretching */
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.rss-grid .card {
    padding: 0; /* Remove padding from the card itself */
}

.rss-card-content {
    padding: 0 1.5rem 1.5rem 1.5rem; /* Add padding to the text content area */
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allows the content area to fill the remaining space */
}

.away-label {
    /* Make the cell itself invisible */
    background: none !important;

    /* Keep the text styling */
    white-space: nowrap;
    transform: rotate(-90deg);
    font-size: 1.25rem !important;
    vertical-align: middle;
}

/* --- 29. Score Ticker --- */
@keyframes scroll-ticker {
    0% {
        transform: translateX(0%);
    }
    100% {
        /* This moves the list left by half its total width, which is
           exactly the length of the first set of scores, creating a seamless loop. */
        transform: translateX(-50%);
    }
}

.score-ticker-container {
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0;
    width: 100%;
    overflow: hidden; /* This hides the overflowing content */
    white-space: nowrap; /* Prevents items from wrapping */
}

.score-ticker ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    /* Apply the animation */
    animation-name: scroll-ticker;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

/* Pause the animation on hover for readability */
.score-ticker-container:hover ul {
    animation-play-state: paused;
}

.score-item {
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    flex-shrink: 0; /* Prevents items from squishing */
}

.score-item .team-logo {
    width: 24px;
    height: 24px;
    margin: 0 0.5rem;
    object-fit: contain;
}

.score-item .team-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.score-item .team-score {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0.5rem;
}

.score-item .game-separator {
    color: var(--secondary-color);
    margin: 0 0.5rem;
}

.score-item .game-status {
    font-size: 0.8rem;
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    margin-left: 1rem;
}

/* --- 31. Easter Egg (Static Footer Version) --- */
.static-easter-egg {
    padding-top: 3rem;
    padding-bottom: 1.5rem;
    text-align: center;
}

.static-easter-egg-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    opacity: 0.6;
    transition: all 0.3s ease;
    cursor: pointer;
}

.static-easter-egg-img:hover {
    opacity: 1;
    transform: scale(1.1);
}