:root {
    --bg-dark: #0f1218;
    --bg-panel: rgba(20, 25, 35, 0.65);
    --bg-panel-hover: rgba(30, 38, 52, 0.8);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-light: rgba(255, 255, 255, 0.15);
    
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.4);
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: linear-gradient(135deg, rgba(30, 38, 52, 0.7) 0%, rgba(20, 25, 35, 0.8) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.glow-card {
    position: relative;
}

.glow-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(to bottom right, rgba(255,255,255,0.2), rgba(255,255,255,0.0));
    z-index: -1;
}

/* AUTH SCREEN */
.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#auth-screen {
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Premium Animations */
@keyframes float1 {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -50px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes float2 {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-30px, 50px) scale(1.2); }
  66% { transform: translate(20px, -20px) scale(0.8); }
  100% { transform: translate(0, 0) scale(1); }
}

.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -2;
    opacity: 0.6;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: rgba(59, 130, 246, 0.25);
    top: -10%;
    left: -10%;
    animation: float1 15s infinite ease-in-out;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: rgba(239, 68, 68, 0.15);
    bottom: -10%;
    right: -5%;
    animation: float2 18s infinite ease-in-out reverse;
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    z-index: 10;
}

.auth-card {
    background: linear-gradient(135deg, rgba(14, 21, 33, 0.8) 0%, rgba(10, 15, 24, 0.9) 100%);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-box {
    width: 72px;
    height: 72px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 0 20px var(--accent-glow);
}

.auth-header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 20px;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 14px 14px 14px 44px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

.input-wrapper select {
    padding-left: 14px; /* Brak ikony z lewej dla select */
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 14px top 50%;
    background-size: 12px auto;
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

select option {
    background-color: var(--bg-dark);
    color: var(--text-main);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    transition: all 0.3s ease;
    outline: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 15px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-full {
    width: 100%;
    margin-top: 10px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: #000; }

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 16px;
    background: rgba(239, 68, 68, 0.1);
    padding: 10px;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    animation: shake 0.4s ease-in-out;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* APP LAYOUT */
#app-screen {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background: rgba(10, 12, 16, 0.95);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    z-index: 20;
    backdrop-filter: blur(20px);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.logo .material-icons-outlined {
    color: var(--accent);
    font-size: 28px;
}

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

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
}

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: auto;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.details .name {
    font-size: 0.9rem;
    font-weight: 600;
}

.details .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.main-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.05), transparent 50%);
    z-index: -1;
    pointer-events: none;
}

.topbar {
    padding: 24px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(15, 18, 24, 0.5);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 100;
}

.topbar h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.time-display {
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
}

.view-container {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.view {
    animation: fadeIn 0.4s ease;
}

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon .material-icons-outlined {
    font-size: 28px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-heading);
}

.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.panel {
    display: flex;
    flex-direction: column;
}

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

.panel-header h3 {
    font-size: 1.1rem;
    color: var(--text-main);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-text:hover {
    text-decoration: underline;
}

.panel-body {
    padding: 24px;
    flex: 1;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-glass);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.95rem;
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.table-cell-bold {
    font-weight: 600;
}

.table-cell-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Incidents List */
.incident-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.incident-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-left: 4px solid var(--accent);
    transition: all 0.2s ease;
}

.incident-card:hover {
    background: rgba(255, 255, 255, 0.03);
}

.incident-card.priority-a { border-left-color: var(--danger); }
.incident-card.priority-b { border-left-color: var(--warning); }
.incident-card.priority-c { border-left-color: var(--success); }

.incident-content h4 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.incident-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 12px;
}

.incident-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.incident-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.incident-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.driver-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.driver-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-glass-light);
}

.driver-avatar {
    width: 48px;
    height: 48px;
    background: var(--bg-panel-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
}

.driver-info h4 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.driver-info .status {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.status-dot.active { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.inactive { background: var(--text-muted); }

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.3s ease;
}

/* Animations */
@keyframes slideUp {
    0% { transform: translateY(40px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

@keyframes slideInRight {
    0% { transform: translateX(50px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

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

.empty-state .material-icons-outlined {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Settings Dropdown */
.settings-dropdown {
    position: absolute;
    top: 60px;
    right: 24px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 16px;
    width: 250px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 1000;
    transform-origin: top right;
    animation: fadeIn 0.2s ease;
}

.settings-dropdown.hidden {
    display: none;
}

.settings-section {
    margin-bottom: 16px;
}
.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.color-circles {
    display: flex;
    gap: 12px;
}

.color-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s ease;
}

.color-circle:hover {
    transform: scale(1.1);
}

.color-circle.active {
    border-color: #fff;
    box-shadow: 0 0 10px currentColor;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: rgba(16, 20, 28, 0.95);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: 80vh;
}
