/* base-ui.css - Comprehensive UI Styles */

/* ============================================================================
   GLOBAL RESET AND BASE STYLES
   ============================================================================ */
* {
    box-sizing: border-box;
}
  
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */
h1, h2, h3, h4, h5, h6 {
    color: #f0f6fc;
    margin: 0 0 16px 0;
}

h1 {
    font-size: 28px;
    font-weight: 700;
}

h2 {
    font-size: 24px;
    font-weight: 600;
}

h3 {
    font-size: 18px;
    font-weight: 600;
}

h4 {
    font-size: 16px;
    font-weight: 600;
}

p {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

a {
    color: #66b2ff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================================================
   HEADER STYLES
   ============================================================================ */
#mainHeader {
    text-align: center;
    margin-bottom: 32px;
    padding: 20px 0;
    border-bottom: 1px solid #30363d;
}

#mainHeader h1 {
    margin: 0 0 16px 0;
    color: #f0f6fc;
    font-size: 28px;
    font-weight: 700;
}

/* ============================================================================
   NAVIGATION TABS
   ============================================================================ */
nav.tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

nav.tabs a.tab-link {
    padding: 10px 20px;
    background: #21262d;
    color: #c9d1d9;
    text-decoration: none;
    border: 1px solid #373e47;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

nav.tabs a.tab-link:hover,
nav.tabs a.tab-link.active {
    background: #58a6ff;
    border-color: #58a6ff;
    color: #ffffff;
}

nav .discord-link {
    background: #5865f2;
    border-color: #5865f2;
    color: #ffffff;
    margin-left: 16px;
}

nav .discord-link:hover {
    background: #4752c4;
    border-color: #4752c4;
}

.discordButton {
    display: inline-block;
    padding: 10px 18px;
    background-color: #7289da;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.discordButton:hover {
    background-color: #5b6eae;
}

/* ============================================================================
   FOOTER STYLES
   ============================================================================ */
footer {
    margin-top: 48px;
    padding: 24px 0;
    border-top: 1px solid #30363d;
    text-align: center;
    color: #8b949e;
    font-size: 14px;
}

#footerContainer {
    margin: 0;
    padding: 0;
    border: none;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 16px;
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */
#mainContent {
    max-width: 1200px;
    margin: 0 auto;
}

main {
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================================================
   SECTION STYLES
   ============================================================================ */
.section {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.section h2 {
    margin: 0 0 16px 0;
    color: #f0f6fc;
    font-size: 24px;
    font-weight: 600;
}

.section h3 {
    margin: 0 0 16px 0;
    color: #f0f6fc;
    font-size: 18px;
    font-weight: 600;
}

.section p {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

main.section {
    border-bottom: none;
    margin-bottom: 0;
}

/* ============================================================================
   OPTIONS GRID LAYOUT
   ============================================================================ */
.options-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

/* ============================================================================
   OPTION GROUP STYLES
   ============================================================================ */
.option-group {
    background: #21262d;
    border: 1px solid #373e47;
    border-radius: 8px;
    padding: 20px;
}

.option-group h4 {
    margin: 0 0 16px 0;
    color: #58a6ff;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #f0f6fc;
    font-weight: 500;
}

.option-container {
    margin-bottom: 16px;
}

.option-control {
    margin-top: 8px;
}

/* ============================================================================
   OPTION DISCLAIMER
   ============================================================================ */
.option-disclaimer {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    background: rgba(251, 133, 0, 0.08);
    border: 1px solid rgba(251, 133, 0, 0.35);
    color: #ffb347;
    display: none;
    animation: disclaimerFadeIn 0.15s ease-out;
}

.option-disclaimer::before {
    content: "⚠ ";
    margin-right: 4px;
    opacity: 0.9;
}

@keyframes disclaimerFadeIn {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.option-disclaimer.danger {
    background: rgba(218, 54, 51, 0.08);
    border-color: rgba(218, 54, 51, 0.35);
    color: #ff7b72;
}

/* ============================================================================
   CUSTOM TOOLTIP
   ============================================================================ */
.custom-tooltip {
    position: fixed;
    background: #21262d;
    color: #c9d1d9;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 10000;
    display: none;
    max-width: 320px;
    line-height: 1.35;
    white-space: pre-line;
    border: 1px solid #373e47;
}

.tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #373e47;
    color: #c9d1d9;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    user-select: none;
}

.tooltip:hover {
    background: #58a6ff;
    color: #ffffff;
}

/* ============================================================================
   MULTISELECT CONTAINER
   ============================================================================ */
.multiselect-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 6px 12px;
}

.multiselect-container label {
    background: #1e242c;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #2d3642;
    transition: background 0.15s, border 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.multiselect-container label:hover {
    background: #26303c;
    border-color: #3a4656;
}

.multiselect-container input[type="checkbox"] {
    transform: scale(1.1);
    accent-color: #58a6ff;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* ============================================================================
   RADIO BUTTON GROUP STYLES
   ============================================================================ */
.radio-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
}

.radio-group button {
    background: #21262d;
    border: 1px solid #373e47;
    color: #c9d1d9;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    min-width: 80px;
}

.radio-group button:hover {
    background: #30363d;
    border-color: #58a6ff;
}

.radio-group button.selected {
    background: #388bfd;
    border-color: #388bfd;
    color: #ffffff;
}

.radio-group button:disabled {
    background: #161b22;
    border-color: #21262d;
    color: #6e7681;
    cursor: not-allowed;
}

/* ============================================================================
   GEAR ICON BUTTON
   ============================================================================ */
.gear-btn {
    background: #373e47;
    border: 1px solid #444c56;
    color: #c9d1d9;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-family: monospace;
    flex-shrink: 0;
}

.gear-btn:hover {
    background: #58a6ff;
    border-color: #58a6ff;
    color: #0d1117;
}

.gear-btn::before {
    content: "⚙️";
    font-size: 14px;
}

.gear-btn-small {
    background: #373e47;
    border: 1px solid #444c56;
    color: #c9d1d9;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    padding: 0;
}

.gear-btn-small:hover {
    background: #58a6ff;
    border-color: #58a6ff;
    color: #0d1117;
}

/* ============================================================================
   INPUT STYLES
   ============================================================================ */
input[type="number"],
input[type="text"] {
    background: #0d1117;
    border: 1px solid #373e47;
    color: #c9d1d9;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
}

input[type="number"] {
    width: 80px;
}

input[type="number"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.1);
}

/* ============================================================================
   STARTING LOCATIONS STYLES
   ============================================================================ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.toggle-btn {
    background: #373e47;
    border: 1px solid #444c56;
    color: #c9d1d9;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.toggle-btn:hover {
    background: #444c56;
}

.location-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
}

#locationSearch {
    background: #0d1117;
    border: 1px solid #373e47;
    color: #c9d1d9;
    padding: 8px 12px;
    border-radius: 6px;
    flex: 1;
    max-width: 300px;
}

#locationSearch:focus {
    outline: none;
    border-color: #58a6ff;
}

#locationsContainer {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #373e47;
    border-radius: 6px;
    padding: 16px;
    background: #0d1117;
}

.location-category {
    font-weight: 600;
    color: #58a6ff;
    margin: 16px 0 8px 0;
    font-size: 16px;
}

.location-category:first-child {
    margin-top: 0;
}

.location-subcategory {
    font-weight: 500;
    color: #f0f6fc;
    margin: 12px 0 8px 16px;
    font-size: 14px;
}

.location-item {
    display: flex;
    align-items: center;
    margin: 4px 0 4px 32px;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.location-item:hover {
    background: #21262d;
}

.location-item input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #58a6ff;
}

.location-item label {
    cursor: pointer;
    user-select: none;
}

.collapsible-content {
    margin-top: 16px;
}

.starting-locations-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #373e47;
    border-radius: 6px;
    padding: 16px;
    background: #0d1117;
}

/* ============================================================================
   GENERATE SECTION
   ============================================================================ */
.generate-section {
    text-align: center;
}

.generate-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 16px;
}

.preset-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ============================================================================
   BUTTON STYLES
   ============================================================================ */
button {
    background: #21262d;
    border: 1px solid #373e47;
    color: #c9d1d9;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

button:hover {
    background: #30363d;
    border-color: #58a6ff;
}

button:disabled {
    background: #161b22;
    border-color: #21262d;
    color: #6e7681;
    cursor: not-allowed;
    opacity: 0.6;
}

.primary-btn,
.primary {
    background: #238636;
    border-color: #238636;
    color: #ffffff;
}

.primary-btn:hover,
.primary:hover {
    background: #2ea043;
    border-color: #2ea043;
}

.secondary-btn {
    background: #58a6ff;
    border-color: #58a6ff;
    color: #ffffff;
}

.secondary-btn:hover {
    background: #4493f8;
    border-color: #4493f8;
}

.cancel-btn {
    background: #da3633;
    border-color: #da3633;
    color: #ffffff;
}

.cancel-btn:hover {
    background: #f85149;
    border-color: #f85149;
}

.danger {
    background: #da3633;
    border-color: #da3633;
    color: #ffffff;
}

/* ============================================================================
   MODAL STYLES
   ============================================================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    margin: 5% auto;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #30363d;
    position: relative;
}

.modal-header h3 {
    margin: 0;
    color: #f0f6fc;
    font-size: 18px;
    flex: 1;
}

.close {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.close:hover {
    color: #f85149;
    background: rgba(248, 81, 73, 0.1);
}

#modalBody,
.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #30363d;
    text-align: right;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-close-btn {
    background: #373e47;
    border: 1px solid #444c56;
    color: #c9d1d9;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.modal-close-btn:hover {
    background: #444c56;
}

.settings-modal {
    display: block;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.settings-modal-content {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    margin: 5% auto;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #30363d;
}

.settings-modal-header h3 {
    margin: 0;
    color: #f0f6fc;
    font-size: 18px;
}

.settings-modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.settings-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #30363d;
    text-align: right;
}

/* ============================================================================
   STATUS MESSAGES
   ============================================================================ */
#statusContainer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
}

.status-message {
    background: #238636;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

.status-message.error {
    background: #da3633;
}

.status-message.warning {
    background: #fb8500;
}

.status-message.info {
    background: #1f6feb;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================================================
   FORM ELEMENTS
   ============================================================================ */
.setting-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 16px;
}

.setting-group label {
    color: #8b949e;
    font-size: 0.9em;
    font-weight: 600;
}

.setting-group select,
.setting-group input {
    padding: 8px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 4px;
    color: #c9d1d9;
    font-size: 1em;
    width: 100%;
}

.setting-group select:focus,
.setting-group input:focus {
    outline: none;
    border-color: #58a6ff;
}

.setting-group select:hover,
.setting-group input:hover {
    border-color: #58a6ff;
}

/* Search boxes */
.search-box {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #30363d;
    background: #0d1117;
    color: #c9d1d9;
    border-radius: 4px;
    font-size: 1em;
}

.search-box:focus {
    outline: none;
    border-color: #58a6ff;
}

/* Validation messages */
.validation-message {
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    font-weight: bold;
    background: #161b22;
    border: 2px solid #30363d;
    color: #c9d1d9;
    white-space: pre-wrap;
}

.validation-message.error {
    background: #2d1519;
    border-color: #da3633;
    color: #f85149;
}

.validation-message.success {
    background: #0f2b1b;
    border-color: #238636;
    color: #2ea043;
}

.validation-message.warning {
    background: #2b2510;
    border-color: #9e6a03;
    color: #d29922;
}

/* Section headers */
.area-header {
    color: #58a6ff;
    font-weight: 600;
    font-size: 1.1em;
    margin: 12px 0 8px;
    padding: 4px 0;
    border-bottom: 1px solid #30363d;
}

.item-category-header {
    color: #f0f6fc;
    font-weight: 600;
    font-size: 1em;
    margin: 10px 0 6px;
    padding: 4px 8px;
    background: #21262d;
    border-radius: 4px;
}

/* ============================================================================
   HIDDEN STATE
   ============================================================================ */
#locationsContent.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

/* ============================================================================
   CUSTOM SCROLLBAR
   ============================================================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #161b22;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #373e47;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444c56;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .options-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .generate-buttons,
    .preset-buttons {
        flex-direction: column;
        align-items: center;
    }

    .radio-group {
        flex-direction: column;
    }

    .location-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-content {
        margin: 2% auto;
        width: 95%;
    }
}