:root {
    --bg-dark-deep: #121212;
    --bg-dark-surface: #1e1e1e;
    --bg-dark-surface-hover: #333333;
    --border-color: #444;
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --accent-pink: #E91E63;
    --accent-pink-hover: #C2185B;
    --status-pending: #ffc107;
    --status-fulfilled: #4caf50;
    --status-rejected: #f44336;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --transition-speed: 0.3s;
    --border-radius: 8px;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark-deep);
    color: var(--text-primary);
    margin: 0;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Layout --- */
.dashboard-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 80px;
    background-color: var(--bg-dark-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: width var(--transition-speed) ease;
    padding: 20px 0;
    box-sizing: border-box;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    display: none;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.sidebar-nav .nav-item {
    position: relative; /* Crucial for badge positioning */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    margin: 10px;
    transition: background-color 0.3s, color 0.3s;
}

.sidebar-nav .nav-item:hover,
.sidebar-nav .nav-item.active {
    background: linear-gradient(45deg, var(--accent-pink), #ff79b0);
    color: white;
}

.sidebar-nav .nav-item .material-icons {
    font-size: 28px;
}

.sidebar-nav .nav-item span {
    display: none;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: var(--accent-pink); /* Use the main accent color */
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 0 8px rgba(233, 30, 99, 0.6); /* Softer shadow with accent color */
    
    /* --- Robust Centering --- */
    line-height: 20px;   /* Vertical centering */
    text-align: center;    /* Horizontal centering */
    box-sizing: border-box;
    padding: 0 2px 0 0; /* Nudge text 2px to the left */
}

.main-content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    width: 100%;
}

.main-content-full-width {
    display: block;
}

/* --- New Page Column Layout --- */
.page-column-container, .requester-container {
    display: flex;
    gap: 20px;
    width: 100%;
    height: 100%;
}

.page-column {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.page-column:first-child {
    width: 400px; /* Fixed width for the left column (parameters/list) */
    flex-shrink: 0;
}

.page-column:last-child {
    flex-grow: 1; /* The right column takes the remaining space */
}

.page-column-body {
    background-color: var(--bg-dark-surface);
    border-radius: var(--border-radius);
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    border: 1px solid var(--border-color);
}

/* Specific body for script output which has a different bg color */
#script-output.page-column-body {
     background-color: #252525;
     box-shadow: 0 2px 10px rgba(0,0,0,0.5);
     position: relative; /* Needed for loader positioning */
}

.requester-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--accent-pink); /* Apply the line here */
    padding-bottom: 0.5rem;   /* Space between text/button and the line */
    margin-bottom: 2.5rem;    /* Space between the line and content below */
}

/* Remove the line and margins from the h2 inside the header */
.requester-header h2 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}


.sidebar-footer {
    display: flex;
    justify-content: center;
    padding: 10px;
}

.sidebar-footer .logout-btn {
    padding: 15px; /* Match the nav-item padding */
    width: auto; /* Let padding define the width */
    margin: 0;
}




.content {
    flex-grow: 1;
    padding: 3rem;
    overflow-y: auto;
    transition: all var(--transition-speed) ease;
}


/* --- General Controls & Forms --- */
button, .btn {
    border: none;
    border-radius: var(--border-radius);
    padding: 0.85rem 1.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
button:active, .btn:active {
    transform: scale(0.97);
}
#new-request-btn {
    background: linear-gradient(45deg, var(--accent-pink), #ff79b0);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 64, 129, 0.2);
    margin-top: 29px;  /* FIX: better UI */
}
#new-request-btn:hover {
    box-shadow: 0 6px 20px rgba(255, 64, 129, 0.3);
    transform: translateY(-2px);
}


.form-group {
    margin-bottom: 2rem;
}
label {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}
input[type="text"], input[type="password"], select, textarea {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-dark-deep);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-family); /* Ensure consistent font */
    transition: all var(--transition-speed) ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-pink);
    box-shadow: 0 0 0 4px rgba(255, 64, 129, 0.25), 0 0 15px rgba(255, 64, 129, 0.2);
    background-color: var(--bg-dark-surface);
}
textarea {
    min-height: 150px;
    resize: vertical;
}

button[type="submit"] {
    background: linear-gradient(45deg, var(--accent-pink), #ff79b0);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 64, 129, 0.2);
}
button[type="submit"]:hover {
    box-shadow: 0 6px 20px rgba(255, 64, 129, 0.3);
    transform: translateY(-2px);
}

/* --- Script Generator Page Specific Tweaks --- */

/* 1. Reduce vertical space between form elements */
#script-form .form-group {
    margin-bottom: 1.25rem;
}

/* 2. Unify fonts for inputs and placeholders */
input::placeholder,
textarea::placeholder {
    color: var(--text-secondary);
    font-family: var(--font-family);
    opacity: 0.7;
}

/* 3. "Cooler" Checkboxes */
.checkbox-row {
    padding-top: 0.5rem; /* Add some space above */
    display: flex;
    gap: 20px;
    align-items: center;
}

.checkbox-group {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 0;
    height: 0;
}

.checkbox-group label {
    padding-left: 35px; /* space for the custom checkbox */
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0; /* Override default label margin */
    user-select: none;
}

/* Custom checkbox circle */
.checkbox-group label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background-color: var(--bg-dark-deep);
    transition: all var(--transition-speed) ease;
}

/* Dot inside the circle */
.checkbox-group label::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: white;
    transition: all var(--transition-speed) ease;
    transition-delay: 0.05s;
}

/* Hover state */
.checkbox-group:hover label::before {
    border-color: var(--accent-pink);
}

/* Checked state */
.checkbox-group input[type="checkbox"]:checked + label::before {
    background-color: var(--accent-pink);
    border-color: var(--accent-pink);
}

.checkbox-group input[type="checkbox"]:checked + label::after {
    transform: translateY(-50%) scale(1);
}

/* Focus state for accessibility */
.checkbox-group input[type="checkbox"]:focus-visible + label::before {
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.3);
}



/* --- Status Badge --- */
.status-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a1a1a;
    min-width: 90px;
    text-align: center;
    text-transform: uppercase;
}
.status-PENDING { background-color: var(--status-pending); }
.status-FULFILLED { background-color: var(--status-fulfilled); color: white; }
.status-REJECTED { background-color: var(--status-rejected); color: white; }

/* --- Content & Details View --- */
.details-container h1, #content-display > h1, .content-centered h1, h1, h2 {
    font-weight: 700;
    font-size: 2.5rem;
    border-bottom: 2px solid var(--accent-pink);
    padding-bottom: 0.5rem;
    margin-bottom: 2.5rem;
    display: inline-block;
    color: var(--text-primary);
}
h3 {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text-secondary);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid;
    border-image-source: linear-gradient(to right, var(--bg-dark-surface) 0%, var(--accent-pink) 50%, var(--bg-dark-surface) 100%);
    border-image-slice: 1;
}

.content-centered h2 {
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.details-container blockquote, .content-centered blockquote {
    background: var(--bg-dark-surface);
    border-left: 6px solid var(--accent-pink);
    margin: 2em 0;
    padding: 1.5em 2em;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-size: 1.1rem;
    line-height: 1.6;
}
.details-content p {
    font-size: 1.1rem;
    line-height: 1.7;
}
.details-content strong {
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 0.5rem;
}

/* --- Login Page --- */
body.login-page {
    font-family: var(--font-family);
    background-color: var(--bg-dark-deep);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}
.login-page .login-container {
    background-color: var(--bg-dark-surface);
    padding: 3rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 450px;
}
.login-page h1 {
    text-align: center;
    color: var(--text-primary);
    font-size: 1.75rem;
    margin-bottom: 2.5rem;
    border-bottom: none; /* Override general h1 style */
}
.login-page .form-group {
    margin-bottom: 1.5rem;
}

.login-page button {
    width: 100%;
    margin-top: 1rem;
}
.login-page .error-message {
    background-color: rgba(244, 67, 54, 0.2);
    color: #fcc2c0;
    border: 1px solid var(--status-rejected);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* --- Script Generator --- */
.cost-display {
    margin-top: 15px;
    padding: 10px 15px;
    background-color: #252525;
    border-radius: 8px;
    text-align: center;
    color: #ccc;
    font-size: 0.9em;
    border: 1px solid #333;
    display: none; /* Hidden by default, shown via JS */
}
.cost-display span {
    color: #E91E63; /* Pink accent color */
    font-weight: bold;
}

.script-step {
    background-color: #333;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #E91E63; /* Pink accent */
    position: relative;
}

.script-step h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #f0f0f0; /* Brighter title */
    border-bottom: none;
}

.script-step p {
    margin: 0;
    white-space: pre-wrap; /* Preserve whitespace and newlines */
    color: #ddd;
}

.alert-item h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-item .alert-timestamp {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.alert-item.unread {
    background-color: #3a3a3a; /* A slightly lighter bg for unread items */
    border-left-color: var(--status-pending); /* Yellow border for unread */
}


.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #444;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
}

.copy-btn:hover {
    background: #E91E63; /* Pink on hover */
}

.placeholder {
    color: #666;
    text-align: center;
    padding-top: 100px;
}

.infloww-controls .form-group {
    display: flex;
    gap: 10px;
    align-items: center;
}
.infloww-controls input {
    flex-grow: 1;
}

.template-controls .form-group {
    display: flex;
    gap: 10px;
    align-items: center;
}
.template-controls input, .template-controls select {
    flex-grow: 1;
}

/* --- Custom Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #252525;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #E91E63;
}


/* --- Custom Slider Styling --- */
input[type=range] {
  -webkit-appearance: none; /* For compatibility with older WebKit/Blink browsers */
  -moz-appearance: none;    /* For compatibility with older Firefox browsers */
  appearance: none;         /* The standard property */
  width: 100%;
  background: transparent; /* Otherwise white in Chrome */
}

input[type=range]:focus {
  outline: none; /* Removes the blue border. You should probably do some kind of focus styling for accessibility */
}

/* Slider Thumb */
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #E91E63;
  cursor: pointer;
  margin-top: -6px; /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
}

/* Slider Track */
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: #444;
  border-radius: 3px;
}

/* --- Loading Animation --- */
.loader-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column; /* Stack loader and timer vertically */
    background-color: rgba(37, 37, 37, 0.8); /* Semi-transparent overlay */
    z-index: 10;
}

.wave-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
}

.wave-loader span {
    display: inline-block;
    width: 10px;
    height: 50px;
    margin: 0 4px;
    background: var(--accent-pink);
    animation: wave-stretch 1.2s infinite ease-in-out;
    border-radius: 4px;
}

.wave-loader span:nth-child(2) { animation-delay: -1.1s; }
.wave-loader span:nth-child(3) { animation-delay: -1.0s; }
.wave-loader span:nth-child(4) { animation-delay: -0.9s; }
.wave-loader span:nth-child(5) { animation-delay: -0.8s; }

@keyframes wave-stretch {
    0%, 40%, 100% {
        transform: scaleY(0.4);
    }
    20% {
        transform: scaleY(1.0);
    }
}

.generation-timer {
    margin-top: 20px;
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.visible {
    display: flex; /* Show the modal */
}

.modal-content {
    background-color: #252525;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 500px;
    text-align: center;
    border-top: 4px solid #E91E63;
}

.modal-title {
    border-bottom: none;
    margin-top: 0;
}

.form-group-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.language-group {
    flex-grow: 1;
}

.request-list-item-details {
    display: flex;
    flex-direction: column;
}

.request-list-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.request-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.request-list-item {
    padding: 1.2rem 2rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color var(--transition-speed) ease;
    position: relative;
}

#model-filter-container {
    padding: .3rem 0;
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
    cursor: grab; /* Better cursor for draggable elements */
    /* Hide scrollbar */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    margin-left: -20px; /* FIX: better UI */
    margin-right: -20px; /* FIX: better UI */
    margin-top: -20px; /* FIX: better UI */
}
#model-filter-container.active-drag {
    cursor: grabbing; /* Show grabbing hand when dragging */
    user-select: none; /* Prevent text selection during drag */
}
#model-filter-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

#model-filter-container .model-filter-btn:first-child {
    margin-left: 20px;
}
#model-filter-container .model-filter-btn:last-child {
    margin-right: 20px;
}

.model-filter-btn {
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 20px;
    background-color: var(--bg-dark-surface-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-speed) ease;
}
.model-filter-btn:hover {
    background-color: #4e4e4e;
    color: var(--text-primary);
    border-color: var(--text-secondary);
}
.model-filter-btn.active {
    background: linear-gradient(45deg, var(--accent-pink), #ff79b0);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(255, 64, 129, 0.2);
}

.item-request-text {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
    font-size: 0.9rem;
    transition: color var(--transition-speed) ease;
}

.item-model-name {
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 1.1rem;
}

/* --- VYRE AI Chat Page --- */
.vyre-ai-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.chat-window {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--bg-dark-surface);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.chat-message {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    max-width: 80%;
    line-height: 1.6;
    word-wrap: break-word;
}

.user-message {
    background-color: var(--accent-pink);
    color: white;
    border-radius: 15px 15px 0 15px;
    align-self: flex-end;
}

.ai-message {
    background-color: #2a2a2a;
    color: var(--text-primary);
    border-radius: 15px 15px 15px 0;
    align-self: flex-start;
}

.ai-message.streaming {
    background: #2a2a2a;
    animation: streaming-pulse 1.5s infinite;
}

@keyframes streaming-pulse {
    0% { background-color: #2a2a2a; }
    50% { background-color: #3a3a3a; }
    100% { background-color: #2a2a2a; }
}

.chat-message.placeholder {
    background-color: transparent;
    text-align: center;
    max-width: 100%;
}
.chat-message.placeholder .chat-message-text {
    color: var(--text-secondary);
}

.chat-input-form {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background-color: var(--bg-dark-surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

#vyre-ai-input {
    flex-grow: 1;
    resize: none;
    min-height: 40px; /* Start height */
    max-height: 200px; /* Max height before scroll */
    height: 40px;
    padding: 10px 15px;
    overflow-y: auto; /* Show scrollbar when max-height is reached */
}

#vyre-ai-send-btn {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-pink);
    color: white;
}

#vyre-ai-send-btn .material-icons {
    font-size: 24px;
}

/* --- Alerts Page --- */
/* Use a highly specific selector to override the default .main-content styles */
body.alerts-page .main-content {
    display: flex;
    flex-direction: column;
    padding: 0; /* Override the default padding */
    height: 100%;
    overflow-y: hidden; /* Prevent the main container from scrolling */
}

.alerts-page .page-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.alerts-page .page-header h2 {
    margin-bottom: 20px;
}

.alerts-page #model-filter-container {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    cursor: grab;
    -ms-overflow-style: none;
    scrollbar-width: none;
    margin: 0 -20px -21px -20px; 
    padding: 10px 20px;
}
.alerts-page #model-filter-container::-webkit-scrollbar {
    display: none;
}

.alerts-page .pagination-container {
    padding: 15px 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* Create 3 columns: left, center, right */
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

/*
 * Justify the first button (prev) to the start of its column,
 * the span (page indicator) to the center of its column,
 * and the last button (next) to the end of its column.
 */
.alerts-page .pagination-container button:first-of-type {
    justify-self: start;
}
.alerts-page .pagination-container span {
    justify-self: center;
}
.alerts-page .pagination-container button:last-of-type {
    justify-self: end;
}

.alerts-page .alerts-body {
    flex-grow: 1; 
    overflow-y: auto; /* This will be the only scrolling element */
    padding: 20px;
    min-height: 0; /* Critical for flexbox scrolling to work */
}

.alerts-page .pagination-container button {
    background-color: var(--bg-dark-surface-hover);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
}

.alerts-page .pagination-container button:disabled {
    background-color: var(--bg-dark-surface);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

.alerts-page .pagination-container span {
    color: var(--text-secondary);
    font-weight: 500;
}
