/* ============================================
   NOTIFICATIONS PAGE - MOBILE OPTIMIZED
   Based on database schema with notifications table
============================================ */

:root {
    --primary: #0B4F6C;
    --primary-dark: #083b4f;
    --primary-light: #1a6b8a;
    --secondary: #10B981;
    --accent: #F59E0B;
    --danger: #EF4444;
    --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);
    --shadow-xl: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 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;
    padding-bottom: 70px; /* Space for bottom nav */
}

/* 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;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

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

/* 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);
}

/* Filter Panel */
.filter-panel {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 16px;
    animation: slideDown 0.3s ease;
}

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

.filter-section {
    margin-bottom: 20px;
}

.filter-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
}

.filter-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-600);
    cursor: pointer;
}

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

.filter-section select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--white);
}

.filter-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.apply-btn, .reset-btn {
    flex: 1;
    padding: 12px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

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

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

.reset-btn {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

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

/* Stats Bar */
.stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 12px 16px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--gray-500);
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: var(--gray-200);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: var(--gray-100);
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Notifications List */
.notifications-list {
    padding: 16px;
}

.notification-item {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.notification-item:active {
    transform: scale(0.98);
    background: var(--gray-50);
}

.notification-item.unread {
    background: rgba(11, 79, 108, 0.05);
    border-left: 4px solid var(--primary);
}

.notification-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.notification-icon.order {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.notification-icon.inquiry {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent);
}

.notification-icon.quote {
    background: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
}

.notification-icon.message {
    background: rgba(139, 92, 246, 0.1);
    color: #8B5CF6;
}

.notification-icon.system {
    background: rgba(107, 114, 128, 0.1);
    color: var(--gray-600);
}

.notification-icon.promotion {
    background: rgba(236, 72, 153, 0.1);
    color: #EC4899;
}

.notification-content {
    flex: 1;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.notification-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}

.notification-time {
    font-size: 11px;
    color: var(--gray-500);
    white-space: nowrap;
}

.notification-message {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 8px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--gray-500);
}

.notification-badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.notification-badge.order {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.notification-badge.inquiry {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent);
}

.notification-badge.quote {
    background: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
}

.notification-badge.message {
    background: rgba(139, 92, 246, 0.1);
    color: #8B5CF6;
}

/* Select Mode */
.notification-item.select-mode {
    padding-left: 50px;
}

.selection-checkbox {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Bulk Actions Bar */
.bulk-actions-bar {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 12px 16px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 90;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.bulk-actions-info {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

.bulk-actions-info span {
    color: var(--primary);
    font-weight: 700;
}

.bulk-actions-buttons {
    display: flex;
    gap: 8px;
}

.bulk-action-icon {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
}

.bulk-action-icon:active {
    background: var(--primary);
    color: white;
}

.bulk-action-icon.danger:active {
    background: var(--danger);
}

/* 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); }
}

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

.empty-state i {
    font-size: 64px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 24px;
}

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

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

/* Load More */
.load-more {
    text-align: center;
    padding: 16px;
}

.load-more-btn {
    padding: 12px 24px;
    background: var(--white);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    display: flex;
    justify-content: space-around;
    padding: 8px 16px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
    z-index: 100;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--gray-400);
    font-size: 11px;
    gap: 4px;
    padding: 8px;
    border-radius: 30px;
}

.bottom-nav .nav-item i {
    font-size: 20px;
}

.bottom-nav .nav-item.active {
    color: var(--primary);
    background: rgba(11, 79, 108, 0.1);
}

.bottom-nav .nav-item:active {
    background: var(--gray-100);
}

/* 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;
}

/* Notification Detail Modal */
.notification-detail {
    text-align: center;
}

.notification-detail-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.notification-detail-icon.order {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.notification-detail-icon.inquiry {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent);
}

.notification-detail-icon.quote {
    background: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
}

.notification-detail-icon.message {
    background: rgba(139, 92, 246, 0.1);
    color: #8B5CF6;
}

.notification-detail h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.notification-detail-time {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.notification-detail-message {
    font-size: 15px;
    color: var(--gray-700);
    line-height: 1.8;
    margin-bottom: 20px;
    text-align: left;
}

.notification-detail-meta {
    background: var(--gray-100);
    padding: 16px;
    border-radius: var(--radius);
    text-align: left;
    font-size: 14px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
}

.meta-row:last-child {
    border-bottom: none;
}

.meta-label {
    color: var(--gray-500);
    font-weight: 500;
}

.meta-value {
    color: var(--gray-800);
    font-weight: 600;
}

/* Bulk Actions Modal */
.bulk-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.bulk-action-btn {
    padding: 16px;
    border: none;
    border-radius: var(--radius);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.bulk-action-btn i {
    width: 24px;
    font-size: 18px;
}

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

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

/* Settings Modal */
.settings-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.settings-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--gray-700);
}

.switch-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--gray-700);
}

.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 26px;
}

.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);
}

.time-range {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.time-range select {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

/* Delete Modal */
.delete-icon {
    text-align: center;
    margin-bottom: 20px;
}

.delete-icon i {
    font-size: 48px;
    color: var(--danger);
}

.delete-message {
    text-align: center;
    font-size: 16px;
    margin-bottom: 8px;
}

.delete-warning {
    text-align: center;
    font-size: 13px;
    color: var(--danger);
    margin-bottom: 20px;
}

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

.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-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);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 90px;
    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) {
    body {
        padding-bottom: 0;
    }
    
    .bottom-nav {
        display: none;
    }
    
    .main-content {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .toast {
        bottom: 30px;
    }
    
    .bulk-actions-bar {
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        width: 500px;
        border-radius: 50px;
    }
}

/* Safe Area Support */
@supports (padding: max(0px)) {
    body {
        padding-bottom: max(70px, env(safe-area-inset-bottom));
    }
    
    .bottom-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        height: calc(70px + env(safe-area-inset-bottom));
    }
    
    .bulk-actions-bar {
        bottom: max(70px, env(safe-area-inset-bottom));
    }
    
    .toast {
        bottom: max(90px, calc(env(safe-area-inset-bottom) + 90px));
    }
}

