/* settings.css - Styles for the settings page */

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #1a1a2e;
    color: #ecf0f1;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ==================== HEADER ==================== */
.options-header {
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(52, 152, 219, 0.2);
    border: 1px solid #3498db;
    color: #3498db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.back-button:hover {
    background: rgba(52, 152, 219, 0.3);
    transform: translateX(-2px);
}

.options-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

/* ==================== LAYOUT ==================== */
.options-container {
    display: flex;
    min-height: calc(100vh - 140px);
    max-width: 1400px;
    margin: 0 auto;
}

/* ==================== SIDEBAR ==================== */
.options-sidebar {
    width: 250px;
    background: rgba(44, 62, 80, 0.5);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem 0;
}

.options-nav {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
}

.nav-item:hover {
    background: rgba(52, 152, 219, 0.1);
    color: #ecf0f1;
}

.nav-item.active {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border-left-color: #3498db;
}

.nav-icon {
    font-size: 1.2rem;
    width: 24px;
}

/* ==================== CONTENT ==================== */
.options-content {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
}

.option-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.option-section.active {
    display: block;
}

.option-section h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: #3498db;
}

/* ==================== OPTION GROUPS ==================== */
.option-group {
    background: rgba(44, 62, 80, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.option-group h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: #ecf0f1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option-group.danger {
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.3);
}

.option-group.danger h3 {
    color: #e74c3c;
}

/* ==================== OPTION ITEMS ==================== */
.option-item {
    margin-bottom: 1.5rem;
}

.option-item:last-child {
    margin-bottom: 0;
}

.option-item label {
    display: block;
    margin-bottom: 0.5rem;
    color: #bdc3c7;
    font-weight: 500;
}

.option-item.checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.option-item.checkbox label {
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
}

.option-item input[type=text],
.option-item input[type=number],
.option-item input[type=email],
.option-item select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ecf0f1;
    font-size: 14px;
    transition: all 0.3s ease;
}

.option-item input[type=text]:focus,
.option-item input[type=number]:focus,
.option-item input[type=email]:focus,
.option-item select:focus {
    outline: none;
    border-color: #3498db;
    background: rgba(255, 255, 255, 0.15);
}

.option-item input[type=checkbox] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option-item input[type=range] {
    width: calc(100% - 60px);
    margin-right: 10px;
    cursor: pointer;
}

.range-value {
    display: inline-block;
    width: 40px;
    text-align: center;
    color: #3498db;
    font-weight: bold;
}

.option-help {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #7f8c8d;
    font-style: italic;
}

/* ==================== BUTTONS ==================== */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: rgba(149, 165, 166, 0.3);
    color: #ecf0f1;
    border: 1px solid rgba(149, 165, 166, 0.5);
}

.btn-secondary:hover {
    background: rgba(149, 165, 166, 0.4);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* ==================== FOOTER ==================== */
.options-footer {
    background: rgba(44, 62, 80, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 2rem;
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: center;
    gap: 1rem;
    backdrop-filter: blur(10px);
}

/* ==================== NOTIFICATION ==================== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(44, 62, 80, 0.95);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.notification.success { border-left: 4px solid #2ecc71; }
.notification.error   { border-left: 4px solid #e74c3c; }
.notification.warning { border-left: 4px solid #f39c12; }
.notification.info    { border-left: 4px solid #3498db; }

.notification-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ==================== KML HEADER ==================== */
.kml-header-enhanced {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(52, 73, 94, 0.3);
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.kml-title-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.kml-main-title {
    font-size: 18px;
    font-weight: 600;
    color: #ecf0f1;
    margin: 0;
}

.kml-subtitle {
    font-size: 13px;
    color: #95a5a6;
    margin: 0;
}

.kml-selection-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.3);
    border-radius: 25px;
}

.counter-label {
    font-size: 13px;
    color: #95a5a6;
    font-weight: 500;
}

.counter-value {
    font-size: 18px;
    font-weight: bold;
    color: #3498db;
    min-width: 25px;
    text-align: center;
}

.counter-separator {
    color: #7f8c8d;
    font-size: 16px;
}

/* ==================== KML SEARCH ==================== */
.kml-search-container {
    margin-bottom: 20px;
}

.kml-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.kml-search-input {
    width: 100%;
    padding: 12px 45px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ecf0f1;
    font-size: 14px;
    transition: all 0.3s ease;
}

.kml-search-input:focus {
    outline: none;
    border-color: #3498db;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.kml-search-input::placeholder {
    color: #7f8c8d;
}

.search-icon {
    position: absolute;
    left: 15px;
    font-size: 16px;
    color: #7f8c8d;
    pointer-events: none;
}

.clear-search-btn {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    color: #7f8c8d;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s ease;
    display: none;
    line-height: 1;
}

.clear-search-btn:hover {
    color: #e74c3c;
    transform: scale(1.2);
}

.clear-search-btn.visible {
    display: block;
}

.search-results-info {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(52, 152, 219, 0.1);
    border-left: 3px solid #3498db;
    border-radius: 4px;
    font-size: 13px;
    color: #bdc3c7;
    display: none;
}

.search-results-info.visible {
    display: block;
    animation: slideDown 0.3s ease;
}

/* ==================== KML LOADING / ERROR ==================== */
.kml-loading {
    text-align: center;
    padding: 2rem;
}

.kml-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(52, 152, 219, 0.2);
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.kml-error {
    text-align: center;
    padding: 2rem;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
}

.error-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 1rem;
}

/* ==================== KML FILE TREE ==================== */
.kml-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
}

.kml-folder {
    margin-bottom: 0.5rem;
    border-left: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.kml-folder:hover {
    border-left-color: #3498db;
}

.kml-folder .kml-folder {
    border-left: 2px solid rgba(52, 152, 219, 0.2);
    margin-left: 10px;
    padding-left: 10px;
}

.kml-folder-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: rgba(52, 152, 219, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background-color 0.3s ease;
    user-select: none;
}

.kml-folder-header:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.kml-folder-header input[type=checkbox] {
    margin-right: 10px;
    cursor: pointer;
}

.kml-folder-title {
    font-weight: 600;
    color: #3498db;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.folder-icon {
    font-size: 1.1em;
}

.folder-toggle {
    cursor: pointer;
    font-size: 0.8em;
    color: #7f8c8d;
    transition: transform 0.3s ease;
    width: 20px;
    text-align: center;
    margin-right: 5px;
}

.folder-toggle:hover {
    color: #3498db;
}

.folder-toggle.expanded {
    transform: rotate(90deg);
}

.folder-toggle-placeholder {
    width: 25px;
    display: inline-block;
}

.folder-content {
    overflow: hidden;
    transition: all 0.3s ease;
}

.kml-files-container {
    padding-left: 20px;
    border-left: 1px dashed #e0e0e0;
    margin-left: 10px;
}

.kml-file {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    margin: 0.25rem 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.kml-file:hover {
    background: rgba(255, 255, 255, 0.08);
}

.kml-file input[type=checkbox] {
    margin-right: 0.75rem;
}

.kml-file label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kml-file-icon {
    font-size: 1em;
    opacity: 0.8;
}

.folder-checkbox:indeterminate {
    opacity: 0.6;
}

/* ==================== KML ACTIONS ==================== */
.kml-actions {
    display: flex;
    gap: 10px;
    padding: 20px;
    background-color: rgba(52, 152, 219, 0.05);
    border-radius: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.kml-actions button {
    min-width: 120px;
}

.kml-actions .expand-buttons {
    display: flex;
    gap: 10px;
    margin-right: 20px;
}

/* ==================== KML SEARCH RESULTS ==================== */
.kml-file.search-hidden,
.kml-folder.search-hidden {
    display: none !important;
}

.kml-file.found {
    background: rgba(52, 152, 219, 0.15) !important;
    border-left: 3px solid #3498db;
    padding-left: 5px;
    animation: pulseFound 0.5s ease;
}

.kml-folder.has-results > .kml-folder-header {
    background: rgba(52, 152, 219, 0.08);
}

.search-highlight {
    background: rgba(52, 152, 219, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
    color: #3498db;
    font-weight: 600;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulseFound {
    0%   { transform: scale(1);    background: rgba(52, 152, 219, 0); }
    50%  { transform: scale(1.01); background: rgba(52, 152, 219, 0.25); }
    100% { transform: scale(1);    background: rgba(52, 152, 219, 0.15); }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .options-container {
        flex-direction: column;
    }

    .options-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 1rem 0;
    }

    .options-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 0 1rem;
    }

    .nav-item {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .nav-item.active {
        border-left-color: transparent;
        border-bottom-color: #3498db;
    }

    .options-content {
        padding: 1.5rem;
    }

    .kml-header-enhanced {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .kml-selection-counter {
        width: 100%;
        justify-content: center;
    }

    .kml-search-input {
        font-size: 16px;
    }

    .kml-files-container {
        padding-left: 10px;
        margin-left: 5px;
    }

    .kml-folder {
        margin-left: 0 !important;
    }

    .kml-actions {
        flex-direction: column;
    }

    .kml-actions button {
        width: 100%;
    }
}