/*
 * Styles for the settings modal window.
 */
/* The full-screen overlay that appears behind the modal. */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}
/* The main modal content window. */
.modal-content {
    background-color: #202123;
    color: white;
    padding: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
/* The header section of the modal. */
.modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid #333;
    padding: 0 100px;
    /* Symmetrical padding for balance */
    margin-bottom: 0;
    width: 100%;
    position: relative;
    flex-shrink: 0;
    height: 50px;
    box-sizing: border-box;
    /* Ensure padding is included in width */
}
.modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 500;
}
/* Generic close button styling. */
.modal-close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
    position: absolute;
    top: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.modal-close-btn:hover {
    background-color: #fff;
    color: #202123;
}
/* Top-right close button (X). */
.modal-close-btn.top-right {
    right: 0;
    font-size: 40px;
}
/* Top-left back button (Arrow).
 */
.modal-close-btn.top-left {
    left: 0;
    font-size: 40px;
}
/* The main body of the modal, containing the form.
 This is now the scroll container. */
.modal-body {
    width: 100%;
    flex: 1;
    min-height: 0;
    padding: 0;
    /* Remove horizontal padding here */
    overflow-y: auto;
    box-sizing: border-box;
}
/* --- START: Custom Scrollbar Styles (Applied to the full-width body) --- */
.modal-body::-webkit-scrollbar {
    width: 8px;
}
.modal-body::-webkit-scrollbar-track {
    background: #202123;
}
.modal-body::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background-color: #777;
}
/* --- END: Custom Scrollbar Styles --- */
/* Container to center the form content inside the scrollable body. */
.settings-form-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 40px;
    box-sizing: border-box;
}
/* A container for a single form element (label + input).
 */
.form-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    /* --- FIX: Standardized vertical padding for all rows --- */
    padding: 12px 0;
    border-bottom: 1px solid #333;
}
/* Style to remove border for grouping items. */
.form-group.no-border {
    border-bottom: none;
    /* --- FIX: Removed specific padding to inherit the standard 12px --- */
}
.form-group:last-child {
    border-bottom: none;
}
/* Wrapper for the label and info button */
.form-label-wrapper {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between icon and label */
    flex-shrink: 0;
}
.form-group label {
    text-align: left;
    font-weight: normal;
    color: #ccc;
    font-size: 16px;
}
/* Wrapper for input/select to control width. Now a flex container. */
.form-control-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    width: 50%;
}
/* The main control should grow, not the info button. */
.form-control-wrapper > *:not(.form-info-btn) {
    flex-grow: 1;
    min-width: 0;
    /* Flexbox fix */
}
/* Base styles for form controls like inputs and selects */
.form-group input,
.form-group select {
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid #888;
    background-color: #333;
    color: white;
    font-size: 16px;
    box-sizing: border-box;
    width: 100%;
}
.form-group input[readonly] {
    background-color: #222;
    cursor: default;
}
/* --- START: Styles for API Key Wrapper and Buttons --- */
.api-key-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
}
.api-key-wrapper input {
    flex-grow: 1;
    min-width: 0;
}
.api-key-btn {
    flex-shrink: 0;
    background: #555;
    border: 1px solid #888;
    color: white;
    cursor: pointer;
    border-radius: 5px;
    width: 36px;
    height: 36px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}
.api-key-btn:hover:not(:disabled) {
    background-color: #777;
}
.api-key-btn:disabled {
    cursor: not-allowed !important;
    opacity: 0.5;
}
.api-key-btn:disabled:hover {
    background-color: #555;
}
/* --- END: Styles for API Key Wrapper and Buttons --- */
/* Styles for Tariff + Upgrade Button Group */
.tariff-control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.tariff-control-group input {
    flex-grow: 1;
    width: auto;
}
.tariff-control-group button {
    flex-shrink: 0;
    width: auto;
}
/* Generic button styles */
.modal-btn {
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #888;
    background-color: #333;
    color: white;
    font-size: 16px;
    box-sizing: border-box;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s ease;
}
.modal-btn.secondary {
    background-color: #666;
    color: white;
}
.modal-btn.secondary:hover {
    background-color: #555;
}
.modal-btn.primary.green {
    background-color: #28a745;
    color: #fff;
    border-color: #28a745;
}
.modal-btn.primary.green:hover {
    background-color: #218838;
    border-color: #218838;
}
.modal-btn.full-width {
    width: 100%;
    max-width: 350px;
}
/* Custom Select Dropdown Arrow */
.select-wrapper {
    position: relative;
    width: 100%;
}
.form-group select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 30px;
    /* Space for the custom arrow */
}
.select-wrapper::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 12px;
    /* Balanced padding from the right edge */
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #ccc;
    /* Arrow color */
    pointer-events: none;
    /* Allows clicks to pass through to the select element */
}
/* Form Info Button */
.form-info-btn {
    /* Reset styles to appear as text */
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: white;
    cursor: default;
    font-size: 20px;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    /* Keep flex-shrink for layout integrity */
    flex-shrink: 0;
}
.form-info-btn:hover {
    opacity: 1;
}