/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
   --bg-primary: #162032;
    --bg-secondary: #1e2d42;
    --bg-tertiary: #263650;
    --bg-card: #1e3560;

    --border-color: #3a5068;

    --text-primary: #f1f5f9;
    --text-secondary: #c8d8e8;
    --text-muted: #7a96b0;

    --border-color: #334155;

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --header-height: 70px;

    --panel-width: 26vw;
    --panel-offset: 1vw;

    --legend-width: 300px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.5;
    overflow: hidden;
}

/* ===== LOGIN ===== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-color);
}

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

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-group input,
.date-input-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.date-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-group small {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.error-message {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.success-message {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

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

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 40px;
    cursor: pointer;
    padding: 6px;
    color: var(--text-secondary);
    transition: color 0.2s;
    border-radius: var(--radius-sm);
    text-decoration: none;
}

.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* ===== APP LAYOUT ===== */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: #1e2d42;
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    z-index: 100;
    height: var(--header-height);
    flex-shrink: 0;
    position: relative;
}

.app-header h1 {

    color: var(--text-primary);
    margin: 0;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-logo-small {
    height: 70px;
    width: auto;
    object-fit: contain;
}

.header-title {
    font-size: 30px;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

.header-logo-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 40px;
    width: auto;
    object-fit: contain;
    pointer-events: none;
}


/* ===== MACHINE BAR ===== */
.machine-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    background: #1e2d42;
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    height: 120px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    z-index: 50;
    gap: 8px;
    position: relative;
}



#machines-list {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    height: 100%;
}

#machines-list::-webkit-scrollbar {
    display: none;
}

.machine-bar::-webkit-scrollbar {
    height: 3px;
}

.machine-bar::-webkit-scrollbar-track {
    background: transparent;
}

.machine-bar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* ===== MACHINE CARD ===== */
.machine-card {
    min-width: 205px;
    max-width: 205px;
    width: 205px;
    height: 100px;
    flex-shrink: 0;
    flex-grow: 0;
    display: block;

    background: #1b3a6b;
    
    border-radius: 10px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    position: relative;
    
}

.machine-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

.machine-card.offline:hover {
    border-color: var(--danger) !important;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.35) !important;
}

.machine-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
    background: #1a2f50;
}

.machine-card:hover .machine-remove-btn {
    opacity: 1;
}



.machine-remove-btn:hover {
    background: var(--danger);
    color: white;
}



.machine-settings-btn:hover {
    opacity: 1;
    color: var(--primary);
    transform: rotate(30deg);
}

/* Tlačítko přidat */
.machine-bar-add {
    min-width: 100px;
    width: 100px;
    height: 96px;
    flex-shrink: 0;
    flex-grow: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: 2px dashed #3b82f6;
    border-radius: 10px;
    color: #3b82f6;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    margin-left: auto;
}

.machine-bar-add:hover {
    background: var(--primary-light);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

.machine-bar-add-icon {
    font-size: 20px;
}

/* Stat boxes uvnitř karet */
.card-stat-box {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 5px;
    padding: 4px 5px;
    text-align: center;
}

/* ===== MAP ===== */
.map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

.map-controls {
    position: absolute;
    top: 20px;
    right: 80px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 500;
}

.map-control-btn {
    width: 42px;
    height: 42px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.map-control-btn:hover {
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-lg);
}

/* ===== DETAIL PANEL ===== */
.details-panel {
    position: fixed;
    width: var(--panel-width);
    right: var(--panel-offset);
    top: calc(var(--header-height) + 120px + 16px);
    
    height: calc(100vh - var(--header-height) - 120px - 32px);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 14px;
}

.panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-primary);
}

.panel-header h2 {
    font-size: 16px;
    margin: 0;
    color: var(--text-primary);
    font-weight: 700;
}

.close-details-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.close-details-btn:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.panel-content::-webkit-scrollbar {
    width: 4px;
}

.panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.panel-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* Detail sekce */
.detail-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    margin-bottom: 6px;
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.detail-section h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-section h3::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
}

.detail-section.stats-section h3::before {
    background: var(--success);
}

.detail-section.chart-section h3::before {
    background: var(--warning);
}

/* Info řádky */
.detail-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    font-size: 13px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.detail-info-row:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.detail-info-row:last-child {
    margin-bottom: 0;
}

.detail-info-label {
    color: var(--text-secondary);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.detail-info-label::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-color);
    flex-shrink: 0;
}

.detail-info-row.location .detail-info-label::before {
    background: var(--primary);
}

.detail-info-row.time .detail-info-label::before {
    background: var(--success);
}

.detail-info-row.gps .detail-info-label::before {
    background: #8b5cf6;
}

.detail-info-value {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 13px;
}

/* ===== STAT CARDS v detail panelu ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

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

.stat-card-wide {
    width: 100%;
}

.stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 14px 12px;
    border-radius: 10px;
    min-height: 72px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    line-height: 1.3;
}

/* Split karty */
.stat-card.split-card {
    padding: 10px 8px;
    min-height: 80px;
}

.stat-block-title {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.stat-double {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
}

.stat-double-item {
    text-align: center;
    padding: 6px 4px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    transition: all 0.2s;
}

.stat-double-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

.stat-double-item:first-child {
    border-right: 1px solid var(--border-color);
}

.stat-double-item .stat-value {
    font-size: 18px;
}

.stat-double-item .stat-label {
    font-size: 9px;
    margin-top: 2px;
}

.stat-double-item:last-child .stat-value {
    color: var(--primary);
}

/* Chart */
.chart-container {
    height: 130px;
    margin-top: 10px;
    position: relative;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 8px;
    border: 1px solid var(--border-color);
}

/* ===== HISTORY ===== */
.history-section {
    padding: 20px;
    background: linear-gradient(135deg, #1e3a5f 0%, #1a2744 100%);
    border-bottom: 1px solid var(--border-color) !important;
    margin-bottom: 0;
}

.history-btn {
    width: 100%;
    padding: 12px;
    font-size: 20px;
    font-weight: 700;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.history-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ===== LOADING ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;

}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== REFRESH INDICATOR ===== */
.refresh-indicator {
    position: fixed;
    top: 72px;
    right: 20px;
    background: var(--primary);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}

.refresh-indicator.show {
    opacity: 1;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;

}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    width: 90%;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

/* Quick dates */
.quick-dates {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.quick-date-btn {
    padding: 9px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-family: inherit;
}

.quick-date-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Date inputs */
.date-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.date-input-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.load-history-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.load-history-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

#history-stats {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 8px;
    margin-top: 14px;
}

#history-stats h4 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* ===== HISTORY LEGEND ===== */
.history-legend {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    font-size: 13px;
    min-width: 260px;
    max-width: 300px;
    border: 1px solid var(--border-color);
}

.history-legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.history-legend-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-legend-title::before {
    content: '📊';
    font-size: 16px;
}

.history-legend-close {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    font-size: 16px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 3px 7px;
    border-radius: 5px;
    transition: all 0.2s;
}

.history-legend-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.history-stats-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    border: 1px solid var(--border-color);
}

.history-stat-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.history-stat-value {
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}

.history-stat-value.highlight {
    color: var(--primary);
}

.history-stat-value.success {
    color: var(--success);
}

.history-legend-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.history-legend-section-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
}

.history-legend-item:last-child {
    margin-bottom: 0;
}

.history-legend-line {
    width: 28px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.history-legend-line.mowing {
    background: var(--success);
    height: 5px;
}

.history-legend-line.driving {
    background: var(--primary);
    height: 3px;
}

.history-legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.history-legend-marker.start {
    background: #22c55e;
}

.history-legend-marker.end {
    background: #ef4444;
}

.history-legend-text {
    color: var(--text-secondary);
    flex: 1;
}

.history-legend-time {
    color: var(--text-muted);
    font-size: 10px;
    margin-left: auto;
}

/* ===== LEGEND NA MAPĚ ===== */
.legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-icon.active {
    background: var(--success);
}

.legend-icon.inactive {
    background: var(--text-muted);
}

/* ===== CUSTOM MAP MARKERS ===== */
.custom-marker {
    background: none;
    border: none;
}

.marker-pin {
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    background: var(--primary);
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -20px 0 0 -12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.marker-pin::after {
    content: '';
    width: 10px;
    height: 10px;
    margin: 7px 0 0 7px;
    background: #fff;
    position: absolute;
    border-radius: 50%;
}

/* ===== ICON PICKER ===== */
.icon-btn {
    width: 44px;
    height: 44px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.1);
}

.icon-btn.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* ===== MACHINES LIST (sidebar fallback) ===== */
.machines-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ===== VERIFY EMAIL ===== */
.verify-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    padding: 20px;
}

.verify-card {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.verify-card h2 {
    margin: 20px 0 10px;
    color: var(--text-primary);
}

.verify-card p {
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.6;
}

.icon-success {
    font-size: 64px;
    color: var(--success);
    margin-bottom: 20px;
}

.icon-error {
    font-size: 64px;
    color: var(--danger);
    margin-bottom: 20px;
}

/* ===== STATUS BADGE ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.active {
    background: var(--success-bg);
    color: var(--success);
}

.status-badge.inactive {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.status-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .details-panel {
        width: 360px;
    }
}

@media (max-width: 768px) {
    .details-panel {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        max-width: 380px;
        z-index: 600;
    }
}

/* Leaflet overrides */
.leaflet-marker-icon {
    border: none !important;
}

.leaflet-control-zoom a {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-tertiary) !important;
}

.leaflet-right .leaflet-control {
    margin-right: 16px;
    transition: margin-right 0.3s;
}

body.panel-open .leaflet-right .leaflet-control {
    margin-right: calc(var(--panel-width) + var(--panel-offset) * 2);
}

body.history-open .leaflet-right .leaflet-control {
    margin-right: calc(var(--legend-width) + var(--panel-offset) * 2);
}

body.is-demo .machine-remove-btn { display: none !important; }
@media (max-width: 768px) {
    .leaflet-top.leaflet-right {
        display: none !important;
    }
}
.leaflet-control-zoom {
    border-radius: var(--radius-md) !important;
    overflow: hidden;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
    border-radius: 0 !important;
}

.leaflet-control-zoom a:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
}

.leaflet-control-zoom a:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .app-container {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .details-panel {
        padding-bottom: env(safe-area-inset-bottom);
    }
}


html, body {
    height: 100%;
}

.app-container {
    height: 100%;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;   /* DŮLEŽITÉ pro flex */
}

.map-container {
    flex: 1;
    position: relative;
    min-height: 0;   /* DŮLEŽITÉ */
}

#map {
    width: 100%;
    height: 100%;
}

/* ===== USER NAME ===== */
.user-name {
    font-size: 26px;       /* 👈 zvětší text */
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

/* ===== LOGIN LOGO ===== */

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

.login-logo {
    width: 140px;
    height: auto;
    margin-bottom: 20px;
}

.login-header h1 {
    margin-top: 0;
}

.header-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 4px 6px;
    background: none;
    border: none;
    text-decoration: none;
    cursor: pointer;
}

.header-icon .icon {
    font-size: 40px;   /* menší emoji */
    line-height: 1;
}

.header-icon .icon-label {
    font-size: 20px;   /* menší text */
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1;
}

.header-icon:hover .icon-label {
    color: var(--text-primary);
}

