/* ============================================
   NOTIFICATION SETTINGS PAGE
   Mobile-optimized settings interface
============================================ */

:root {
    --primary: #0B4F6C;
    --primary-dark: #083b4f;
    --primary-light: #1a6b8a;
    --secondary: #10B981;
    --accent: #F59E0B;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --dark: #1F2937;
    --gray-800: #1F2937;
    --gray-700: #374151;
    --gray-600: #4B5563;
    --gray-500: #6B7280;
    --gray-400: #9CA3AF;
    --gray-300: #D1D5DB;
    --gray-200: #E5E7EB;
    --gray-100: #F3F4F6;
    --white: #FFFFFF;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--gray-100);
    color: var(--dark);
    line-height: 1.5;
}

/* Mobile Header */
.mobile-header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.back-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--gray-600);
    cursor: pointer;
}

.back-btn:active {
    background: var(--gray-100);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.logo-circle {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}

.logo-text span {
    color: var(--primary);
    font-weight: 400;
}

.save-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.save-btn:active {
    background: var(--primary-dark);
}

.save-btn i {
    font-size: 14px;
}

/* Page Title */
.page-title {
    padding: 16px;
}

.page-title h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.page-title p {
    font-size: 14px;
    color: var(--gray-500);
}

/* Main Content */
.main-content {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

/* Settings Sections */
.settings-section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 0 4px;
}

.section-header i {
    width: 24px;
    color: var(--primary);
    font-size: 18px;
}

.section-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Settings Cards */
.settings-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-100);
}

.setting-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.setting-item:first-child {
    padding-top: 0;
}

.setting-info {
    flex: 1;
    padding-right: 16px;
}

.setting-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.setting-info p {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.4;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 26px;
    flex-shrink: 0;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: .2s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Color Picker */
.color-picker {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--gray-200);
}

.color-picker input[type="color"] {
    width: 150%;
    height: 150%;
    margin: -25%;
    cursor: pointer;
    border: none;
    background: transparent;
}

/* Input Field */
.input-field {
    width: 160px;
}

.input-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-xs);
    font-size: 14px;
}

.input-field input:focus {
    outline: none;
    border-color: var(--primary);
}

/* SMS Options */
.sms-options {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}

/* Quiet Hours */
.quiet-hours-options {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}

.time-range {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 20px;
}

.time-select {
    flex: 1;
}

.time-select label {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.time-select select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-xs);
    font-size: 14px;
    background: var(--white);
}

.time-separator {
    padding-bottom: 10px;
    color: var(--gray-400);
    font-weight: 500;
}

/* Days Select */
.days-select {
    margin-top: 16px;
}

.days-label {
    display: block;
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.day-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.day-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--gray-300);
    background: var(--white);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.day-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Channel Items */
.channel-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-100);
}

.channel-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.channel-item:first-child {
    padding-top: 0;
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.channel-icon {
    width: 40px;
    height: 40px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 18px;
}

.channel-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.channel-address {
    font-size: 13px;
    color: var(--gray-500);
}

.channel-status {
    font-size: 13px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 20px;
}

.channel-status.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.channel-status.inactive {
    background: var(--gray-100);
    color: var(--gray-500);
}

.connect-btn {
    padding: 8px 16px;
    background: var(--white);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.connect-btn:active {
    background: var(--primary);
    color: white;
}

/* Frequency Select */
.frequency-select {
    width: 140px;
    padding: 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-xs);
    font-size: 14px;
    background: var(--white);
}

/* Clear History Button */
.clear-history-btn {
    width: 100%;
    padding: 14px;
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.clear-history-btn:active {
    background: var(--danger);
    color: white;
}

/* Blocked List */
.blocked-list {
    margin-bottom: 16px;
}

.blocked-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--gray-100);
    border-radius: var(--radius-xs);
    margin-bottom: 8px;
}

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

.blocked-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.blocked-info i {
    width: 20px;
    color: var(--gray-500);
}

.unblock-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.unblock-btn:active {
    background: var(--danger);
    color: white;
}

.empty-blocked {
    text-align: center;
    padding: 30px;
    color: var(--gray-400);
}

.empty-blocked i {
    font-size: 32px;
    margin-bottom: 8px;
}

.empty-blocked p {
    font-size: 14px;
}

.add-block-btn {
    width: 100%;
    padding: 14px;
    background: var(--white);
    border: 2px dashed var(--gray-300);
    color: var(--gray-600);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.add-block-btn:active {
    background: var(--gray-100);
    border-color: var(--primary);
    color: var(--primary);
}

/* Danger Zone */
.danger-zone .section-header i,
.danger-zone .section-header h2 {
    color: var(--danger);
}

.danger-card {
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.02);
}

.danger-btn {
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.danger-btn:active {
    background: var(--danger);
    color: white;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 10;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:active {
    background: var(--gray-100);
    color: var(--danger);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Form Group */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--gray-700);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-xs);
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Modal Icons */
.modal-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.modal-icon.success {
    background: #E7F5E8;
    color: var(--secondary);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Buttons */
.btn-primary {
    flex: 1;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-secondary {
    flex: 1;
    padding: 14px;
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary:active {
    background: var(--gray-100);
}

.btn-danger {
    flex: 1;
    padding: 14px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-danger:active {
    background: #dc2626;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s;
    max-width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--secondary);
}

.toast.error {
    background: var(--danger);
}

.toast.info {
    background: var(--primary);
}

/* Tablet Styles */
@media (min-width: 768px) {
    .main-content {
        padding: 24px;
    }
    
    .settings-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Safe Area Support */
@supports (padding: max(0px)) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .mobile-header {
        padding-top: max(0px, env(safe-area-inset-top));
    }
    
    .toast {
        bottom: max(30px, env(safe-area-inset-bottom));
    }
}