/* ============================================
   JunkShun Client Portal - Main Stylesheet
   Version: 2.0
   Updated: January 2025
   ============================================ */

/* Root Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-alt: #0066cc;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --success-alt: #28a745;
    --danger-color: #ef4444;
    --danger-alt: #dc3545;
    --warning-color: #f59e0b;
    --warning-alt: #ffc107;
    --background: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #666;
    --border-color: #e2e8f0;
    --border-light: #e0e0e0;
    --primary-blue: #004080;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;
    --border-radius-pill: 50px;
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ============================================
   Navigation Styles
   ============================================ */
.navbar {
    background: var(--card-background) !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--primary-color) !important;
}

.navbar-brand img {
    height: 60px;
    margin-right: 10px;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

.nav-link.active {
    color: var(--primary-color) !important;
}

.nav-link.text-danger {
    color: var(--danger-color) !important;
}

.dropdown-menu {
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--background);
    color: var(--primary-color);
}

.dropdown-item i {
    width: 1.25rem;
    margin-right: 0.5rem;
}

/* ============================================
   Main Content Layout
   ============================================ */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

.main-container {
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 2rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.client-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.section-title i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

/* ============================================
   Card Components
   ============================================ */
.section-card {
    background: var(--card-background);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-card .section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
}

/* ============================================
   Geofence Components
   ============================================ */

/* Section Numbers */
.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary-alt);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
    margin-right: 0.5rem;
}

/* Map Styles */
.geofence-map,
#map {
    height: 450px;
    width: 100%;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
}

.map-controls {
    background: var(--background);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Coordinates Display */
.coordinates-display {
    background: var(--background);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1rem;
    display: none;
}

.coordinates-display.active {
    display: block;
}

/* Radius Controls */
.radius-display {
    background: var(--background);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    margin-top: 1rem;
}

.radius-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-alt);
}

.radius-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Custom Range Slider */
.form-range {
    height: 8px;
    cursor: pointer;
}

.form-range::-webkit-slider-track {
    background: linear-gradient(to right, var(--success-alt) 0%, var(--warning-alt) 50%, var(--danger-alt) 100%);
    border-radius: 4px;
}

.form-range::-moz-range-track {
    background: linear-gradient(to right, var(--success-alt) 0%, var(--warning-alt) 50%, var(--danger-alt) 100%);
    border-radius: 4px;
}

.form-range::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid var(--primary-alt);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid var(--primary-alt);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.range-markers {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.range-marker {
    flex: 1;
}

/* Location Input Group */
.location-input-group {
    position: relative;
}

.location-input-group .form-control {
    padding-left: 2.5rem;
}

.location-input-group .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Character Counter */
.character-counter {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 0.25rem;
}

.character-counter.warning {
    color: var(--warning-alt);
}

.character-counter.danger {
    color: var(--danger-alt);
}

/* Status Components */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--background);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.status-dot.active {
    background: var(--success-alt);
    animation: pulse 2s infinite;
}

.status-dot.inactive {
    background: var(--danger-alt);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-pill);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.status-badge.active {
    background: #d4edda;
    color: var(--success-alt);
    border: 1px solid var(--success-alt);
}

.status-badge.inactive {
    background: #f8d7da;
    color: var(--danger-alt);
    border: 1px solid var(--danger-alt);
}

/* Location Header */
.location-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.location-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.info-item {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary-alt);
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

/* Info Box */
.info-box {
    background: #e8f4fd;
    border-left: 4px solid var(--primary-alt);
    padding: 1rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin-bottom: 1rem;
}

.info-box ul {
    margin-bottom: 0;
    padding-left: 1.2rem;
}

.info-box li {
    margin-bottom: 0.5rem;
}

/* Quota Indicator */
.quota-indicator {
    background: linear-gradient(to right, #e9ecef 0%, #e9ecef 100%);
    height: 8px;
    border-radius: 4px;
    margin: 1rem 0;
    position: relative;
    overflow: hidden;
}

.quota-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--primary-alt);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.quota-fill.warning {
    background: var(--warning-alt);
}

.quota-fill.danger {
    background: var(--danger-alt);
}

.quota-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Toggle Container */
.toggle-container {
    background: var(--background);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
}

/* Enhanced Form Switch */
.form-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.form-switch .form-check-input {
    width: 60px;
    height: 30px;
    margin-right: 1rem;
    cursor: pointer;
}

.form-switch .form-check-input:checked {
    background-color: var(--success-alt);
    border-color: var(--success-alt);
}

.form-switch .form-check-label {
    /*font-size: 1.2rem;*/
    font-size: 1.0rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

/* Alert Boxes */
.alert-box {
    background: #fff3cd;
    border: 1px solid var(--warning-alt);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.alert-box.success {
    background: #d4edda;
    border-color: var(--success-alt);
}

.alert-box.danger {
    background: #f8d7da;
    border-color: var(--danger-alt);
}

/* ============================================
   Stats Cards & Grid
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-background);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.stat-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.stat-card-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card-percent {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

/* Color variants for stat cards */
.stat-card.success .stat-card-value {
    color: var(--success-color);
}

.stat-card.danger .stat-card-value {
    color: var(--danger-color);
}

.stat-card.warning .stat-card-value {
    color: var(--warning-color);
}

/* ============================================
   Data Tables
   ============================================ */
.data-table-container {
    background: var(--card-background);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.table-header {
    padding: 1.25rem 1.5rem;
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
}

.table-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.custom-table {
    margin: 0;
}

.custom-table thead th {
    background: var(--background);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    border-top: none;
}

.custom-table tbody tr {
    transition: all 0.2s ease;
}

.custom-table tbody tr:hover {
    background: var(--background);
}

.custom-table tbody td,
.custom-table tbody th {
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.custom-table tbody tr:last-child td,
.custom-table tbody tr:last-child th {
    border-bottom: none;
}

.indent-1 {
    padding-left: 2.5rem !important;
    color: var(--text-secondary);
}

.table-divider {
    background: var(--background);
    height: 1px;
}

/* ============================================
   Badges & Labels
   ============================================ */
.count-badge {
    display: inline-block;
    background: var(--background);
    color: var(--text-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
}

/* ============================================
   Footer
   ============================================ */
footer {
    background: var(--primary-blue);
    color: white;
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-content img {
    height: 20px;
    margin: 0 8px;
    opacity: 0.7;
}

/* ============================================
   Form Elements
   ============================================ */
.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-alt);
    border: none;
    padding: 0.75rem 2rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #0052a3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,102,204,0.2);
}

.btn-secondary {
    background: white;
    color: var(--text-muted);
    border: 1px solid #ddd;
    padding: 0.75rem 2rem;
    font-weight: 500;
}

.btn-secondary:hover {
    background: var(--background);
    border-color: #ccc;
    color: var(--text-primary);
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

/* ============================================
   Alerts & Notifications
   ============================================ */
.alert {
    border: none;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

/* ============================================
   Utility Classes
   ============================================ */
.text-primary {
    color: var(--primary-color) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .custom-table {
        font-size: 0.875rem;
    }
    
    .custom-table thead th,
    .custom-table tbody td,
    .custom-table tbody th {
        padding: 0.75rem;
    }
    
    .indent-1 {
        padding-left: 1.5rem !important;
    }
    
    .client-name {
        font-size: 1.5rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-card-value {
        font-size: 1.5rem;
    }
    
    .location-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .radius-value {
        font-size: 2rem;
    }
    
    #map,
    .geofence-map {
        height: 350px;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .nav-link {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem !important;
    }
    
    .data-table-container {
        border-radius: 0.5rem;
    }
    
    .table-header {
        padding: 1rem;
    }
    
    .custom-table thead th,
    .custom-table tbody td,
    .custom-table tbody th {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .main-container {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .section-card {
        padding: 1rem;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 0.625rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .form-switch .form-check-input {
        width: 50px;
        height: 25px;
    }
}