/* Locations Page Styles */
.locations-main {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.locations-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.locations-header h2 {
    font-size: 1.75rem;
    color: white;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.locations-header h2::before {
    content: '📍';
    font-size: 1.5rem;
}

.locations-header .btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    background: #27ae60;
    border: none;
    color: white;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
    transition: all 0.2s;
}

.locations-header .btn-primary:hover {
    background: #2ecc71;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

/* Notification Settings */
.notification-settings {
    margin-bottom: 1.5rem;
}

.settings-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
}

.settings-card h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.notification-option {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.notification-option:last-of-type {
    border-bottom: none;
}

.notification-option .toggle-label {
    flex: 1;
    min-width: 200px;
}

.notification-option .settings-email,
.notification-option .push-status {
    flex: 1;
    min-width: 150px;
    margin: 0;
    font-size: 0.85rem;
    color: #666;
}

.push-status.push-status-granted {
    color: #27ae60;
    font-weight: 500;
}

.push-status.push-status-default {
    color: #7f8c8d;
}

.push-status.push-status-denied {
    color: #e74c3c;
}

.push-status.push-status-unsupported {
    color: #95a5a6;
    font-style: italic;
}

.push-status.push-status-error {
    color: #e74c3c;
}

.toggle-slider-disabled {
    background: #bdc3c7 !important;
    cursor: not-allowed;
}

.dev-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.app-status {
    flex: 1;
    min-width: 150px;
    margin: 0;
    font-size: 0.85rem;
    color: #7f8c8d;
    font-style: italic;
}

.test-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.test-btn:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-1px);
}

.test-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 26px;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle-label input:checked + .toggle-slider {
    background: #27ae60;
}

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

.toggle-text {
    font-size: 0.95rem;
    color: #2c3e50;
}

.settings-email {
    font-size: 0.9rem;
    color: #2c3e50;
    margin: 0.75rem 0 0 0;
}

.settings-email strong {
    color: #27ae60;
}

.settings-info {
    font-size: 0.8rem;
    color: #888;
    margin: 0.5rem 0 0 0;
}

.locations-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.locations-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.loading, .empty-message {
    color: #666;
    text-align: center;
    padding: 2rem;
}

/* Location Card */
.location-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
}

.location-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.location-card h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin: 0;
}

.location-card-actions {
    display: flex;
    gap: 0.5rem;
}

.location-card-actions button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: #666;
    font-size: 1rem;
}

.location-card-actions button:hover {
    color: #2c3e50;
}

.location-card-actions .delete-btn:hover {
    color: #e74c3c;
}

.location-coords {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.location-gts {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 6px;
}

.location-gts .gts-label {
    font-size: 0.85rem;
    color: #666;
}

.location-gts .gts-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #27ae60;
}

/* Alerts Section */
.location-alerts {
    border-top: 1px solid #eee;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.alerts-header h4 {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
    font-weight: 500;
}

.add-alert-btn {
    background: transparent;
    border: 1px solid #27ae60;
    color: #27ae60;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.add-alert-btn:hover {
    background: #27ae60;
    color: white;
}

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.85rem;
}

.alert-item.disabled {
    opacity: 0.5;
}

.alert-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-gts {
    font-weight: 600;
    color: #e67e22;
    min-width: 50px;
}

.alert-label {
    color: #2c3e50;
}

.alert-status {
    font-size: 0.75rem;
    color: #888;
}

.alert-actions {
    display: flex;
    gap: 0.25rem;
}

.alert-actions button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: #888;
    font-size: 0.85rem;
}

.alert-actions button:hover {
    color: #2c3e50;
}

.alert-actions .delete-alert-btn:hover {
    color: #e74c3c;
}

.no-alerts {
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
}

/* Preset Buttons */
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.preset-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: #e67e22;
    border-color: #e67e22;
    color: white;
}

.preset-btn .preset-gts {
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.location-gts {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
}

.location-gts-current, .location-gts-forecast {
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.location-gts-value {
    font-weight: 600;
    color: #2c3e50;
}

/* Locations Map */
.locations-map-container {
    position: sticky;
    top: 2rem;
    height: calc(100vh - 200px);
    min-height: 400px;
}

.locations-map {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-small {
    max-width: 350px;
    padding: 1.5rem;
    text-align: center;
}

.modal-small h3 {
    margin-bottom: 0.5rem;
}

.modal-small p {
    color: #666;
    margin-bottom: 1.5rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-close:hover {
    color: #333;
}

#location-form {
    padding: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.modal-map {
    height: 250px;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin-top: 0.5rem;
}

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

.btn-danger:hover {
    background: #c0392b;
}

/* Alert Modal Styling */
#alert-modal .modal-content {
    max-width: 480px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#alert-modal .modal-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    padding: 1.25rem 1.5rem;
    border-bottom: none;
}

#alert-modal .modal-header h3 {
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#alert-modal .modal-header h3::before {
    content: '\1F514';
    font-size: 1.2rem;
}

#alert-modal .modal-close {
    color: white;
    opacity: 0.8;
}

#alert-modal .modal-close:hover {
    opacity: 1;
    color: white;
}

#alert-form {
    padding: 1.5rem;
}

#alert-form .form-group {
    margin-bottom: 1.25rem;
}

#alert-form .form-group label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Preset Buttons - Better Grid Layout */
.preset-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.preset-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.preset-btn:hover {
    background: #f0f7f4;
    border-color: #27ae60;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.2);
}

.preset-btn .preset-gts {
    font-weight: 700;
    color: #27ae60;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Threshold Input with Unit */
.threshold-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#alert-threshold {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: border-color 0.2s;
}

#alert-threshold:focus {
    outline: none;
    border-color: #27ae60;
}

.threshold-unit {
    position: absolute;
    right: 1rem;
    color: #888;
    font-weight: 600;
}

/* Label Input */
#alert-label {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: border-color 0.2s;
}

#alert-label:focus {
    outline: none;
    border-color: #27ae60;
}

/* Alert Form Actions */
#alert-form .form-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

#alert-form .btn-primary {
    background: #27ae60;
    border: none;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
}

#alert-form .btn-primary:hover {
    background: #2ecc71;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

/* Checkbox styling */
#alert-enabled-group {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 900px) {
    .locations-content {
        grid-template-columns: 1fr;
    }

    .locations-map-container {
        position: relative;
        top: 0;
        height: 400px;
        order: -1;
    }
}

@media (max-width: 480px) {
    .locations-main {
        padding: 1rem;
    }

    .locations-header {
        padding: 1.25rem 1rem;
    }

    .locations-header h2 {
        font-size: 1.5rem;
    }

    .locations-header .btn-primary {
        width: 100%;
    }
}

/* Alert History Modal */
#history-modal .modal-content {
    max-width: 550px;
}

.history-modal-header {
    background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 100%);
    color: white;
    border-radius: 8px 8px 0 0;
}

.history-modal-header h3 {
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-modal-header h3::before {
    content: '\1F4C5';
}

.history-modal-header .modal-close {
    color: white;
    opacity: 0.8;
}

.history-modal-header .modal-close:hover {
    opacity: 1;
}

.history-modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.history-loading {
    text-align: center;
    color: #888;
    padding: 2rem;
}

.history-empty {
    text-align: center;
    color: #888;
    padding: 2rem;
    font-style: italic;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa, #fff);
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: #9b59b6;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.1);
}

.history-item-info {
    flex: 1;
}

.history-item-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.history-item-location {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.history-item-date {
    font-size: 0.8rem;
    color: #888;
}

.history-item-values {
    text-align: right;
}

.history-item-gts {
    font-size: 1.1rem;
    font-weight: 700;
    color: #27ae60;
}

.history-item-threshold {
    font-size: 0.8rem;
    color: #e67e22;
    margin-top: 0.25rem;
}

.history-item-forecast {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.25rem;
}

/* History Button in Alert Item */
.history-alert-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: #9b59b6;
    font-size: 0.85rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.history-alert-btn:hover {
    opacity: 1;
}
