/**
 * Settings Page Styles
 * Extends the base style.css for the settings page
 */

/* Settings Container */
.settings-container {
    max-width: 800px;
}

/* Settings Header */
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--company-color, #B82C39);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.company-logo {
    height: 50px;
    width: auto;
}

.settings-header h1 {
    font-size: 1.5rem;
    color: var(--company-color, #B82C39);
    margin: 0;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.btn-restart {
    background: #ff9800;
    color: #000;
}

.btn-restart:hover {
    background: #ffb74d;
}

.btn-accept {
    background: #00c853;
    color: #fff;
}

.btn-accept:hover {
    background: #00e676;
}

.btn-cancel {
    background: #555;
    color: #fff;
}

.btn-cancel:hover {
    background: #777;
}

/* System Status Section */
.system-status-section {
    background: #0f3460;
}

.system-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 80px;
}

.stat-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #00d4ff;
}

/* Settings Sections */
.settings-section {
    background: #16213e;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.settings-section h2 {
    color: var(--company-color, #B82C39);
    border-bottom: 1px solid #0f3460;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.section-note {
    color: #888;
    font-style: italic;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

/* Disabled Section */
.disabled-section {
    opacity: 0.6;
}

.disabled-section input,
.disabled-section select {
    cursor: not-allowed;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 600px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item.full-width {
    grid-column: span 2;
}

@media (max-width: 600px) {
    .setting-item.full-width {
        grid-column: span 1;
    }
}

.setting-item label {
    color: #aaa;
    font-size: 0.9rem;
}

.setting-item input[type="text"],
.setting-item input[type="number"],
.setting-item select {
    padding: 10px 12px;
    background: #0f3460;
    border: 2px solid #1a1a2e;
    border-radius: 6px;
    color: #fff;
    font-size: 1rem;
}

.setting-item input[type="text"]:focus,
.setting-item input[type="number"]:focus,
.setting-item select:focus {
    outline: none;
    border-color: var(--company-color, #B82C39);
}

.setting-item input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* Input with Toggle */
.input-with-toggle {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-with-toggle input[type="number"] {
    flex: 1;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #555;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: #00c853;
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(24px);
}

/* Slider Container */
.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-container input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 8px;
    background: #0f3460;
    border-radius: 4px;
    outline: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--company-color, #B82C39);
    border-radius: 50%;
    cursor: pointer;
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--company-color, #B82C39);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.slider-container input[type="range"]:disabled::-webkit-slider-thumb {
    background: #555;
    cursor: not-allowed;
}

.slider-value {
    min-width: 45px;
    text-align: right;
    color: #aaa;
    font-size: 0.9rem;
}

/* Audio Test Buttons */
.audio-test-buttons {
    flex-direction: row !important;
    gap: 15px;
}

.audio-test-buttons .btn {
    flex: 1;
}

.btn-secondary {
    background: #0f3460;
    border: 2px solid #00d4ff;
    color: #00d4ff;
}

.btn-secondary:hover {
    background: #00d4ff;
    color: #000;
}

.btn-secondary.active {
    background: #00c853;
    border-color: #00c853;
    color: #fff;
}

.btn-danger {
    border-color: #ff5252;
    color: #ff5252;
}

.btn-danger:hover {
    background: #ff5252;
    color: #fff;
}

/* Filter Mode Buttons */
.filter-mode-buttons {
    display: flex;
    gap: 10px;
}

.filter-mode-btn {
    flex: 1;
    padding: 10px 15px;
    background: #0f3460;
    border: 2px solid #1a1a2e;
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-mode-btn:hover {
    border-color: #00d4ff;
    color: #00d4ff;
}

.filter-mode-btn.active {
    background: var(--company-color, #B82C39);
    border-color: var(--company-color, #B82C39);
    color: #fff;
}

/* Filter List */
.filter-list-input {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.filter-list-input input {
    flex: 1;
    padding: 10px 12px;
    background: #0f3460;
    border: 2px solid #1a1a2e;
    border-radius: 6px;
    color: #fff;
}

.filter-list-input input:focus {
    outline: none;
    border-color: var(--company-color, #B82C39);
}

.filter-list {
    list-style: none;
    max-height: 150px;
    overflow-y: auto;
}

.filter-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #0f3460;
    border-radius: 4px;
    margin-bottom: 5px;
}

.filter-list .btn-remove {
    background: none;
    border: none;
    color: #ff5252;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
}

.filter-list .btn-remove:hover {
    color: #ff8a80;
}

/* Call History */
.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#history-count {
    color: #888;
}

.call-history {
    max-height: 300px;
    overflow-y: auto;
    background: #0a0a15;
    border-radius: 8px;
    padding: 10px;
}

.no-history {
    color: #666;
    text-align: center;
    padding: 20px;
}

.history-item {
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-bottom: 1px solid #1a1a2e;
}

.history-item:last-child {
    border-bottom: none;
}

.history-main {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.history-cli {
    font-weight: bold;
    color: #fff;
}

.history-direction {
    font-size: 1.2rem;
}

.history-direction.incoming {
    color: #00d4ff;
}

.history-direction.outgoing {
    color: #00c853;
}

.history-details {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: #888;
}

.history-item.blocked .history-status {
    color: #ff5252;
}

.history-item.missed .history-status {
    color: #ffc107;
}

.history-item.completed .history-status {
    color: #00c853;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #16213e;
    border-radius: 10px;
    padding: 25px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    color: var(--company-color, #B82C39);
    margin-bottom: 15px;
}

.modal-content p {
    color: #ccc;
    margin-bottom: 25px;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.modal-buttons .btn {
    min-width: 100px;
}

/* Setting Hints */
.setting-hint {
    color: #666;
    font-size: 0.8rem;
    margin-top: 4px;
}

/* VAD Status Summary */
.vad-status-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 12px 15px;
    background: #0f3460;
    border-radius: 8px;
    border-left: 4px solid #555;
}

.vad-status-label {
    color: #888;
    font-size: 0.9rem;
}

.vad-status-value {
    font-weight: bold;
    font-size: 0.95rem;
    padding: 4px 10px;
    border-radius: 4px;
    background: #1a1a2e;
}

.vad-status-value.disabled {
    color: #888;
}

.vad-status-value.enabled {
    color: #ffc107;
    background: rgba(255, 193, 7, 0.15);
}

.vad-status-value.active {
    color: #00c853;
    background: rgba(0, 200, 83, 0.15);
}

.vad-status-summary:has(.vad-status-value.active) {
    border-left-color: #00c853;
}

.vad-status-summary:has(.vad-status-value.enabled) {
    border-left-color: #ffc107;
}

/* Help Tooltip */
.help-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    background: #0f3460;
    border: 1px solid #00d4ff;
    border-radius: 50%;
    color: #00d4ff;
    font-size: 11px;
    font-weight: bold;
    cursor: help;
    position: relative;
    vertical-align: middle;
    transition: all 0.2s;
}

.help-tooltip:hover {
    background: #00d4ff;
    color: #000;
}

/* Tooltip popup */
.help-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    padding: 10px 12px;
    background: #1a1a2e;
    border: 1px solid #00d4ff;
    border-radius: 6px;
    color: #ccc;
    font-size: 0.8rem;
    font-weight: normal;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Tooltip arrow */
.help-tooltip::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #00d4ff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 101;
}

.help-tooltip:hover::after,
.help-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Adjust tooltip position for items near edges */
.setting-item:nth-child(even) .help-tooltip::after {
    left: auto;
    right: -10px;
    transform: none;
}

.setting-item:nth-child(even) .help-tooltip::before {
    left: auto;
    right: 5px;
    transform: none;
}
