/* ===================================================================
   KEYWORD RULES - CELLULAR VIEW STYLES
   A phone-number focused view for keyword rules
   =================================================================== */

/* View Toggle Navigation */
.view-toggle-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    border: 1px solid #cbd5e0;
}

.view-toggle-bar .view-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #cbd5e0;
    background: white;
    color: #4a5568;
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-toggle-bar .view-btn:hover {
    background: #edf2f7;
    border-color: #a0aec0;
    transform: translateY(-1px);
}

.view-toggle-bar .view-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.view-toggle-bar .view-btn.active:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.view-toggle-bar .view-btn i {
    font-size: 1em;
}

/* Stats Row in View Toggle */
.view-stats-row {
    display: flex;
    gap: 16px;
    margin-left: auto;
}

.view-stat-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.view-stat-mini i {
    font-size: 1.1em;
}

.view-stat-mini .stat-content {
    display: flex;
    flex-direction: column;
}

.view-stat-mini .stat-number {
    font-weight: 700;
    font-size: 1.1em;
    color: #2d3748;
    line-height: 1;
}

.view-stat-mini .stat-label {
    font-size: 0.7em;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cellular View Container */
.cellular-view-container {
    display: none;
    padding: 0;
}

.cellular-view-container.active {
    display: block;
}

/* Cellular View Header */
.cellular-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 12px 12px 0 0;
    border: 1px solid #86efac;
    border-bottom: none;
}

.cellular-search {
    position: relative;
    flex: 0 1 400px;
}

.cellular-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #22c55e;
    font-size: 1em;
}

.cellular-search input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 2px solid #86efac;
    border-radius: 10px;
    font-size: 1em;
    background: white;
    transition: all 0.3s ease;
}

.cellular-search input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.cellular-search input::placeholder {
    color: #9ca3af;
}

.cellular-stats {
    display: flex;
    gap: 20px;
}

/* Date Range Filter */
.cellular-date-range {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-range-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-range-group label {
    font-size: 0.85em;
    font-weight: 600;
    color: #166534;
}

.date-range-group input[type="date"] {
    padding: 8px 12px;
    border: 2px solid #86efac;
    border-radius: 8px;
    font-size: 0.9em;
    background: white;
    color: #334155;
    cursor: pointer;
    transition: all 0.3s ease;
}

.date-range-group input[type="date"]:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.date-clear-btn {
    padding: 8px 12px;
    border: 2px solid #fca5a5;
    border-radius: 8px;
    background: white;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-clear-btn:hover {
    background: #fef2f2;
    border-color: #f87171;
}

.cellular-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #166534;
    font-weight: 600;
}

.cellular-stat .stat-count {
    background: white;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #86efac;
}

/* Cellular View Content */
.cellular-view-content {
    background: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 65vh;
    overflow-y: auto;
}

/* Phone Card Styling */
.phone-card {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.phone-card:last-child {
    border-bottom: none;
}

.phone-card:hover {
    background: linear-gradient(135deg, #f0fdf4 0%, #fafafa 100%);
}

.phone-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.phone-card-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.phone-icon-wrapper {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 12px;
    color: white;
    font-size: 1.3em;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

.phone-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Company Name (Primary) */
.company-name {
    font-size: 1.4em;
    font-weight: 700;
    color: #1e293b;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Phone Number (Secondary) */
.phone-number {
    font-size: 1em;
    font-weight: 500;
    color: #22c55e;
    font-family: 'Segoe UI', system-ui, sans-serif;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.phone-number.no-phone {
    color: #9ca3af;
    font-style: italic;
    font-weight: 500;
}

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

.phone-action-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.phone-action-btn.view-btn {
    background: #e0f2fe;
    color: #0369a1;
}

.phone-action-btn.view-btn:hover {
    background: #bae6fd;
}

.phone-action-btn.edit-btn {
    background: #fef3c7;
    color: #b45309;
}

.phone-action-btn.edit-btn:hover {
    background: #fde68a;
}

.phone-action-btn.details-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 12px;
    font-size: 0.85em;
}

.phone-action-btn.details-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Phone Card Details Grid */
.phone-card-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px 24px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    margin-top: 8px;
    overflow: hidden;
}

.phone-detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
}

.phone-detail-label {
    font-size: 0.75em;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.phone-detail-value {
    font-size: 0.9em;
    color: #334155;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.phone-detail-value.empty {
    color: #cbd5e0;
    font-style: italic;
}

/* Keyword Badge */
.keyword-badge {
    display: inline-block;
    background: #e0e7ff;
    color: #4338ca;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 0.85em;
}

/* Search Highlight */
.search-highlight {
    background-color: #fef08a;
    color: #854d0e;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* Classification Badge */
.classification-badge {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85em;
}

/* Group Badge */
.group-badge {
    display: inline-block;
    background: #dcfce7;
    color: #166534;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Empty State */
.cellular-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.cellular-empty-state i {
    font-size: 4em;
    color: #cbd5e0;
    margin-bottom: 20px;
}

.cellular-empty-state h3 {
    margin-bottom: 10px;
    color: #475569;
}

.cellular-empty-state p {
    font-size: 0.95em;
}

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

.cellular-loading .loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 3px solid rgba(34, 197, 94, 0.3);
    border-radius: 50%;
    border-top-color: #22c55e;
    animation: spin 1s ease-in-out infinite;
}

/* Scrollbar Styling */
.cellular-view-content::-webkit-scrollbar {
    width: 8px;
}

.cellular-view-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.cellular-view-content::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

.cellular-view-content::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Responsive Design */
@media (max-width: 768px) {
    .view-toggle-bar {
        flex-wrap: wrap;
    }
    
    .view-stats-row {
        width: 100%;
        margin-left: 0;
        margin-top: 12px;
        justify-content: center;
    }
    
    .cellular-view-header {
        flex-direction: column;
        gap: 16px;
    }
    
    .cellular-search {
        width: 100%;
        flex: none;
    }
    
    .cellular-date-range {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .phone-card-header {
        flex-direction: column;
        gap: 16px;
    }
    
    .phone-card-details {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .view-toggle-bar .view-btn {
        padding: 8px 14px;
        font-size: 0.85em;
    }
    
    .view-toggle-bar .view-btn span {
        display: none;
    }
    
    .cellular-date-range {
        flex-direction: column;
        gap: 8px;
    }
    
    .date-range-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .date-range-group input[type="date"] {
        flex: 1;
    }
    
    .phone-card-details {
        grid-template-columns: 1fr;
    }
}

/* ===================================================================
   DARK THEME SUPPORT
   =================================================================== */

body.theme-dark .view-toggle-bar {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-color: rgba(148, 163, 184, 0.3);
}

body.theme-dark .view-toggle-bar .view-btn {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(148, 163, 184, 0.3);
    color: #e2e8f0;
}

body.theme-dark .view-toggle-bar .view-btn:hover {
    background: rgba(71, 85, 105, 0.9);
    border-color: rgba(148, 163, 184, 0.5);
}

body.theme-dark .view-toggle-bar .view-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: rgba(59, 130, 246, 0.5);
}

/* Stats Mini Cards */
body.theme-dark .view-stat-mini {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(148, 163, 184, 0.3);
}

body.theme-dark .view-stat-mini .stat-number {
    color: #f1f5f9;
}

body.theme-dark .view-stat-mini .stat-label {
    color: #94a3b8;
}

/* Cellular View Header */
body.theme-dark .cellular-view-header {
    background: linear-gradient(135deg, rgba(22, 101, 52, 0.3) 0%, rgba(21, 128, 61, 0.2) 100%);
    border-color: rgba(34, 197, 94, 0.3);
}

body.theme-dark .cellular-search input {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(34, 197, 94, 0.4);
    color: #e2e8f0;
}

body.theme-dark .cellular-search input::placeholder {
    color: #64748b;
}

body.theme-dark .cellular-search input:focus {
    background: rgba(15, 23, 42, 0.9);
    border-color: #22c55e;
}

body.theme-dark .cellular-stat {
    color: #86efac;
}

body.theme-dark .cellular-stat .stat-count {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

/* Date Range */
body.theme-dark .date-range-group label {
    color: #86efac;
}

body.theme-dark .date-range-group input[type="date"] {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(34, 197, 94, 0.4);
    color: #e2e8f0;
}

body.theme-dark .date-clear-btn {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

body.theme-dark .date-clear-btn:hover {
    background: rgba(127, 29, 29, 0.3);
    border-color: rgba(239, 68, 68, 0.6);
}

/* Cellular View Content */
body.theme-dark .cellular-view-content {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(148, 163, 184, 0.3);
}

/* Phone Cards */
body.theme-dark .phone-card {
    border-bottom-color: rgba(148, 163, 184, 0.2);
}

body.theme-dark .phone-card:hover {
    background: linear-gradient(135deg, rgba(22, 101, 52, 0.15) 0%, rgba(51, 65, 85, 0.5) 100%);
}

body.theme-dark .company-name {
    color: #f1f5f9;
}

body.theme-dark .phone-number {
    color: #86efac;
}

body.theme-dark .phone-number.no-phone {
    color: #64748b;
}

/* Phone Card Details Grid */
body.theme-dark .phone-card-details {
    background: rgba(51, 65, 85, 0.6);
}

body.theme-dark .phone-detail-label {
    color: #94a3b8;
}

body.theme-dark .phone-detail-value {
    color: #e2e8f0;
}

body.theme-dark .phone-detail-value.empty {
    color: #64748b;
}

/* Badges */
body.theme-dark .keyword-badge {
    background: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}

body.theme-dark .classification-badge {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

body.theme-dark .group-badge {
    background: rgba(34, 197, 94, 0.25);
    color: #86efac;
}

/* Action Buttons */
body.theme-dark .phone-action-btn.view-btn {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

body.theme-dark .phone-action-btn.view-btn:hover {
    background: rgba(59, 130, 246, 0.35);
}

body.theme-dark .phone-action-btn.edit-btn {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

body.theme-dark .phone-action-btn.edit-btn:hover {
    background: rgba(245, 158, 11, 0.35);
}

/* Empty State */
body.theme-dark .cellular-empty-state {
    color: #94a3b8;
}

body.theme-dark .cellular-empty-state i {
    color: #475569;
}

body.theme-dark .cellular-empty-state h3 {
    color: #cbd5e1;
}

/* Loading State */
body.theme-dark .cellular-loading .loading-spinner {
    border-color: rgba(34, 197, 94, 0.2);
    border-top-color: #22c55e;
}

/* Scrollbar */
body.theme-dark .cellular-view-content::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.5);
}

body.theme-dark .cellular-view-content::-webkit-scrollbar-thumb {
    background: #475569;
}

body.theme-dark .cellular-view-content::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}
