/* ============================================
   MANTIS RFID - Warehouse Dashboard Styles
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12131a;
    --bg-elevated: #1a1b24;
    --bg-hover: #22232e;
    --border: #2a2b36;
    --border-light: #3a3b46;
    --text-primary: #ffffff;
    --text-secondary: #8b8d98;
    --text-muted: #5c5e6a;
    --accent-green: #22c55e;
    --accent-green-dim: #166534;
    --accent-blue: #3b82f6;
    --accent-blue-dim: #1d4ed8;
    --accent-orange: #f97316;
    --accent-orange-dim: #c2410c;
    --accent-red: #ef4444;
    --accent-red-dim: #b91c1c;
    --accent-purple: #a855f7;
    --accent-cyan: #06b6d4;
    --accent-yellow: #eab308;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Global Navigation Bar */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    padding: 0 40px;
}
.top-nav .nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.top-nav .nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}
.top-nav .nav-brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--bg-dark);
}
.top-nav .nav-brand-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
}
.top-nav .nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}
.top-nav .nav-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.top-nav .nav-link:hover {
    color: var(--text-primary);
    background: var(--border);
}
.top-nav .nav-link.active {
    color: #f97316;
    background: rgba(249, 115, 22, 0.1);
}
.top-nav .nav-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 8px;
}
.top-nav .nav-section-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 4px;
}
.top-nav .nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}
@media (max-width: 1024px) {
    .top-nav .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--bg-dark);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 16px;
        gap: 4px;
    }
    .top-nav .nav-links.open { display: flex; }
    .top-nav .nav-link { width: 100%; padding: 12px 16px; }
    .top-nav .nav-divider { width: 100%; height: 1px; margin: 8px 0; }
    .top-nav .nav-section-label { width: 100%; padding: 8px 16px 4px; }
    .top-nav .nav-toggle { display: block; }
    .top-nav { padding: 0 20px; }
}

/* Dashboard Layout */
.dashboard {
    height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-card);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

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

.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--accent-orange);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 22px;
    color: var(--bg-dark);
}

.logo-text {
    font-weight: 700;
    font-size: 20px;
}

.logo-text span {
    color: var(--accent-orange);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.header-divider {
    color: var(--border);
}

.header-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 26px;
    color: var(--text-primary);
    font-weight: 600;
}

/* Main Layout */
.main-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 260px 1fr 340px;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.nav-item {
    padding: 14px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-hover);
}

.nav-item.active {
    background: var(--accent-green);
    color: var(--bg-dark);
}

.nav-item.active .nav-badge {
    background: var(--bg-dark);
    color: var(--accent-green);
}

.nav-icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
}

.nav-label {
    flex: 1;
}

.nav-badge {
    background: var(--accent-red);
    color: white;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.nav-badge.blue { background: var(--accent-blue); }
.nav-badge.orange { background: var(--accent-orange); }
.nav-badge.green { background: var(--accent-green); color: var(--bg-dark); }

/* Content Area */
.content {
    padding: 24px;
    overflow-y: auto;
    background: var(--bg-dark);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
}

.search-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 320px;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--accent-green);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
}

.stat-value.green { color: var(--accent-green); }
.stat-value.blue { color: var(--accent-blue); }
.stat-value.orange { color: var(--accent-orange); }
.stat-value.red { color: var(--accent-red); }
.stat-value.purple { color: var(--accent-purple); }
.stat-value.cyan { color: var(--accent-cyan); }

.stat-change {
    font-size: 12px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.up { color: var(--accent-green); }
.stat-change.down { color: var(--accent-red); }
.stat-change.neutral { color: var(--text-muted); }

/* Project Cards Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.project-card:hover {
    border-color: var(--accent-green);
    transform: translateY(-2px);
}

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

.project-name {
    font-weight: 600;
    font-size: 16px;
}

.project-location {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.status-badge {
    font-size: 10px;
    padding: 5px 12px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: var(--accent-green-dim);
    color: var(--accent-green);
}

.status-badge.pending {
    background: var(--accent-orange-dim);
    color: var(--accent-orange);
}

.progress-section {
    margin-bottom: 14px;
}

.progress-bar {
    height: 10px;
    background: var(--bg-elevated);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
    border-radius: 5px;
    transition: width 0.5s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.project-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.metric {
    text-align: center;
    padding: 10px;
    background: var(--bg-elevated);
    border-radius: 8px;
}

.metric-value {
    font-weight: 700;
    font-size: 18px;
    font-family: 'JetBrains Mono', monospace;
}

.metric-label {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 2px;
}

/* Activity Panel */
.activity-panel {
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px;
}

.activity-header {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.live-indicator {
    font-size: 12px;
    color: var(--accent-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.activity-list {
    flex: 1;
    overflow-y: auto;
}

.activity-item {
    padding: 14px;
    border-radius: 10px;
    background: var(--bg-elevated);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.activity-item:hover {
    background: var(--bg-hover);
}

.activity-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.activity-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.activity-text strong {
    color: var(--text-primary);
}

.activity-tag {
    display: inline-block;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    margin-top: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.activity-tag.scan { background: var(--accent-blue); }
.activity-tag.complete { background: var(--accent-green); color: var(--bg-dark); }
.activity-tag.alert { background: var(--accent-red); }
.activity-tag.ship { background: var(--accent-purple); }

.quick-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Buttons */
.btn-primary {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    background: var(--accent-green);
    color: var(--bg-dark);
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 14px 24px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    background: var(--bg-elevated);
    color: var(--text-primary);
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 14px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-elevated);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.data-table tr {
    cursor: pointer;
    transition: background 0.2s;
}

.data-table tr:hover {
    background: var(--bg-hover);
}

.data-table td {
    font-size: 14px;
}

.table-id {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--accent-cyan);
}

.stage-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.stage-badge.fab { background: var(--accent-purple); }
.stage-badge.shipped { background: var(--accent-blue); }
.stage-badge.onsite { background: var(--accent-cyan); color: var(--bg-dark); }
.stage-badge.installing { background: var(--accent-orange); color: var(--bg-dark); }
.stage-badge.complete { background: var(--accent-green); color: var(--bg-dark); }
.stage-badge.punch { background: var(--accent-red); }

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 10px 20px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab:hover {
    border-color: var(--accent-green);
    color: var(--text-primary);
}

.filter-tab.active {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--bg-dark);
}

.filter-tab .count {
    margin-left: 6px;
    opacity: 0.7;
}

/* Cards List */
.cards-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.list-card:hover {
    border-color: var(--accent-green);
    transform: translateX(4px);
}

.list-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.list-card-icon.blue { background: rgba(59, 130, 246, 0.2); }
.list-card-icon.green { background: rgba(34, 197, 94, 0.2); }
.list-card-icon.orange { background: rgba(249, 115, 22, 0.2); }
.list-card-icon.purple { background: rgba(168, 85, 247, 0.2); }
.list-card-icon.red { background: rgba(239, 68, 68, 0.2); }

.list-card-content {
    flex: 1;
}

.list-card-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.list-card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.list-card-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 700;
}

/* Grid Cards */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

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

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
}

.info-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.info-card-title {
    font-weight: 600;
    font-size: 16px;
}

/* Crew Card */
.crew-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.crew-card:hover {
    border-color: var(--accent-blue);
}

.crew-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.crew-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.crew-name {
    font-weight: 600;
    font-size: 15px;
}

.crew-role {
    font-size: 12px;
    color: var(--text-muted);
}

.crew-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.crew-stat {
    background: var(--bg-elevated);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.crew-stat-value {
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.crew-stat-label {
    font-size: 10px;
    color: var(--text-muted);
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* Scan Modal */
.scan-modal {
    text-align: center;
}

.scan-area {
    padding: 40px 20px;
}

.scan-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
}

.scan-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid var(--accent-green);
    border-radius: 50%;
    animation: scanRing 2s infinite;
}

.scan-ring:nth-child(1) { width: 60px; height: 60px; animation-delay: 0s; }
.scan-ring:nth-child(2) { width: 90px; height: 90px; animation-delay: 0.5s; }
.scan-ring:nth-child(3) { width: 120px; height: 120px; animation-delay: 1s; }

@keyframes scanRing {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
}

.scan-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
}

.scan-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.scan-hint {
    font-size: 14px;
    color: var(--text-muted);
}

.scan-result {
    padding: 24px;
    background: var(--bg-elevated);
    border-radius: 12px;
    margin: 20px;
}

.result-success {
    color: var(--accent-green);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}

.result-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 20px;
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

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

.settings-section h3 {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
}

.setting-label {
    font-weight: 500;
}

.setting-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Toggle Switch */
.toggle {
    width: 52px;
    height: 28px;
    background: var(--bg-elevated);
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle.active {
    background: var(--accent-green);
}

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

.toggle.active::after {
    transform: translateX(24px);
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
}

/* Priority Badge */
.priority {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.priority.high { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }
.priority.medium { background: rgba(249, 115, 22, 0.2); color: var(--accent-orange); }
.priority.low { background: rgba(34, 197, 94, 0.2); color: var(--accent-green); }

/* Timeline */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-green);
    border: 2px solid var(--bg-dark);
}

.timeline-item.pending::before {
    background: var(--text-muted);
}

.timeline-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-content {
    font-size: 14px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Mobile Header Bar - Hidden on desktop */
.mobile-header {
    display: none;
    position: sticky;
    top: 0;
    z-index: 101;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    align-items: center;
    justify-content: space-between;
}

.hamburger-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.hamburger-btn:hover {
    background: var(--bg-hover);
}

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: all 0.3s ease;
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-logo .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
}

.mobile-logo .logo-text {
    font-weight: 700;
    font-size: 16px;
}

.activity-toggle-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    position: relative;
    transition: background 0.2s;
}

.activity-toggle-btn:hover {
    background: var(--bg-hover);
}

.activity-toggle-icon {
    font-size: 20px;
}

.activity-badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* Activity Panel Handle - Hidden on desktop */
.activity-panel-handle {
    display: none;
    padding: 12px 0 8px;
    cursor: pointer;
}

.handle-bar {
    width: 40px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 0 auto;
}

/* ============================================
   TABLET BREAKPOINT (768px - 1024px)
   ============================================ */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 220px 1fr 280px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-box {
        width: 240px;
    }
}

/* ============================================
   MOBILE BREAKPOINT (768px and below)
   ============================================ */
@media (max-width: 768px) {
    /* Show mobile header, hide desktop header */
    .mobile-header {
        display: flex !important;
    }
    
    .header {
        display: none !important;
    }
    
    /* Dashboard container adjustments */
    .dashboard {
        height: 100vh;
        height: 100dvh;
    }
    
    /* Main Layout - Single column */
    .main-layout {
        grid-template-columns: 1fr !important;
        grid-template-rows: 1fr !important;
        position: relative;
    }
    
    /* Sidebar as slide-out overlay */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        height: 100dvh;
        z-index: 100;
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.3s ease, visibility 0.3s;
        padding-top: 70px;
        border-right: 1px solid var(--border);
        overflow-y: auto;
    }
    
    .sidebar.open {
        transform: translateX(0);
        visibility: visible;
    }
    
    /* Content Area */
    .content {
        padding: 16px;
        padding-bottom: 80px; /* Space for activity panel handle */
    }
    
    /* Activity Panel - Bottom sheet style */
    .activity-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: auto;
        max-height: 70vh;
        z-index: 100;
        transform: translateY(calc(100% - 60px));
        transition: transform 0.3s ease;
        border-top: 1px solid var(--border);
        border-left: none;
        border-radius: 20px 20px 0 0;
        padding: 0 16px 24px;
    }
    
    .activity-panel.open {
        transform: translateY(0);
    }
    
    .activity-panel-handle {
        display: block;
    }
    
    .activity-header {
        padding-top: 8px;
    }
    
    .quick-actions {
        flex-direction: row;
    }
    
    .quick-actions button {
        flex: 1;
        padding: 12px 16px;
    }
    
    /* Page Header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .search-box {
        width: 100%;
    }
    
    /* Stats Grid - 2 columns on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    /* Projects Grid */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .project-metrics {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .metric {
        padding: 8px;
    }
    
    .metric-value {
        font-size: 16px;
    }
    
    /* Cards List */
    .list-card {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .list-card-content {
        flex: 1 1 60%;
    }
    
    .list-card-value {
        font-size: 18px;
    }
    
    /* Grid layouts */
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    /* Filter Tabs - Scrollable on mobile */
    .filter-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .filter-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .filter-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Data Tables - Card Layout on Mobile */
    .data-table {
        border-radius: 12px;
    }
    
    .data-table thead {
        display: none;
    }
    
    .data-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .data-table tr {
        display: flex;
        flex-direction: column;
        background: var(--bg-elevated);
        border-radius: 12px;
        padding: 16px;
        gap: 10px;
        border: 1px solid var(--border);
    }
    
    .data-table tr:hover {
        background: var(--bg-hover);
        transform: none;
    }
    
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0;
        border: none;
        font-size: 14px;
    }
    
    .data-table td::before {
        content: attr(data-label);
        font-size: 12px;
        color: var(--text-muted);
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .data-table td:first-child {
        padding-bottom: 8px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 4px;
    }
    
    .data-table td:first-child::before {
        display: none;
    }
    
    .table-id {
        font-size: 16px;
    }
    
    /* Crew Cards Grid */
    .crew-card {
        padding: 16px;
    }
    
    .crew-stats {
        gap: 6px;
    }
    
    /* Section Headers */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    /* Buttons */
    .btn-primary,
    .btn-secondary {
        padding: 12px 20px;
    }
    
    /* Modal adjustments */
    .modal-content {
        width: 95%;
        max-height: 85vh;
        margin: 10px;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    /* Settings */
    .setting-item {
        padding: 14px;
    }
    
    /* Info Cards */
    .info-card {
        padding: 16px;
    }
}

/* ============================================
   SMALL MOBILE BREAKPOINT (480px and below)
   ============================================ */
@media (max-width: 480px) {
    /* Stats Grid - Single column for very small screens */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .stat-card > div:first-child {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .stat-label {
        margin-bottom: 0;
    }
    
    .stat-change {
        margin-top: 0;
    }
    
    /* Project Metrics - 3 columns stays, but smaller */
    .project-metrics {
        gap: 6px;
    }
    
    .metric {
        padding: 6px;
    }
    
    .metric-value {
        font-size: 14px;
    }
    
    .metric-label {
        font-size: 10px;
    }
    
    /* Sidebar wider on very small screens */
    .sidebar {
        width: 85%;
        max-width: 320px;
    }
    
    /* List cards stack completely */
    .list-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .list-card-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .list-card-value {
        align-self: flex-end;
        margin-top: -20px;
    }
    
    /* Activity Panel */
    .activity-panel {
        max-height: 80vh;
    }
    
    .activity-item {
        padding: 12px;
    }
    
    /* Page Title */
    .page-title {
        font-size: 18px;
    }
    
    /* Priority badges */
    .priority {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    /* Timeline adjustments */
    .timeline {
        padding-left: 20px;
    }
    
    .timeline-item::before {
        left: -16px;
        width: 10px;
        height: 10px;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-item {
        padding: 16px;
        min-height: 52px;
    }
    
    .filter-tab {
        padding: 12px 20px;
        min-height: 44px;
    }
    
    .btn-primary,
    .btn-secondary {
        min-height: 48px;
    }
    
    .toggle {
        width: 56px;
        height: 32px;
    }
    
    .toggle::after {
        width: 26px;
        height: 26px;
    }
    
    /* Remove hover effects that don't work well on touch */
    .stat-card:hover,
    .project-card:hover,
    .list-card:hover,
    .crew-card:hover {
        transform: none;
    }
    
    /* Better tap feedback */
    .nav-item:active,
    .stat-card:active,
    .project-card:active,
    .list-card:active,
    .filter-tab:active {
        background: var(--bg-hover);
        transform: scale(0.98);
    }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .activity-panel {
        max-height: 60vh;
    }
    
    .sidebar {
        width: 50%;
        max-width: 300px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
