/* MEVO System - FINAL CSS (przyciski pobierz + wszystkie poprawki) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0066CC;
    --primary-dark: #004499;
    --secondary-color: #f8f9fa;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --text-color: #333;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --input-bg: #ffffff;
    --hover-bg: #f8f9fa;
}

/* Tryb ciemny */
[data-theme="dark"] {
    --text-color: #e0e0e0;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --border-color: #404040;
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
    --input-bg: #2a2a2a;
    --hover-bg: #2a2a2a;  
    --secondary-color: #2a2a2a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout główny */
#app {
    min-height: 100vh;
    position: relative;
    padding-bottom: 80px;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    padding-bottom: 100px;
}

.screen.active {
    display: block;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.mevo-logo {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-color);
    opacity: 0.8;
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Karty formularzy */
.form-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    background: var(--input-bg);
    color: var(--text-color);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Przyciski */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--card-bg);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

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

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary.small,
.btn-secondary.small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* NOWY: Przycisk pobierz */
.btn-download {
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-download:hover {
    background: #218838;
    transform: scale(1.05);
}

/* Toggle switch dla trybu ciemnego */
.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    transition: all 0.3s ease;
    font-weight: 600;
}

.toggle-label:hover {
    border-color: var(--primary-color);
    background: var(--hover-bg);
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--border-color);
    border-radius: 13px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: var(--card-bg);
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input[type="checkbox"] {
    display: none;
}

input[type="checkbox"]:checked + .toggle-switch {
    background: var(--primary-color);
}

input[type="checkbox"]:checked + .toggle-switch::after {
    transform: translateX(24px);
}

/* Radio buttons */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    background: var(--input-bg);
}

.radio-label:hover {
    border-color: var(--primary-color);
    background: var(--hover-bg);
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 1rem;
    position: relative;
    transition: all 0.3s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary-color);
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Lokalizacja */
.location-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.location-controls button {
    flex: 1;
}

.selected-location {
    padding: 1rem;
    background: rgba(0, 102, 204, 0.1);
    border-radius: 8px;
    border: 2px solid var(--primary-color);
}

.location-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Załączniki */
.attachments-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.attachment-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;  
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
}

.attachment-item img,
.attachment-item video {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.attachment-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 0.8rem;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    border-top: 1px solid var(--border-color);
    display: flex;
    padding: 0.5rem;
    z-index: 1000;
}

.bottom-nav.hidden {
    display: none;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    color: var(--text-color);
}

.nav-btn:hover,
.nav-btn.active {
    background: rgba(0, 102, 204, 0.1);
    color: var(--primary-color);
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.nav-label {
    font-size: 0.75rem;
    font-weight: 500;
}

/* TABELA ZGŁOSZEŃ */
.table-container {
    background: var(--card-bg);
    border-radius: 12px;
    overflow-x: auto;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
}

.reports-table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
}

.reports-table th,
.reports-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.reports-table th {
    background: var(--secondary-color);
    font-weight: 600;
    color: var(--text-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

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

/* Problem info */
.problem-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.problem-type {
    background: rgba(0, 102, 204, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
}

.bike-number {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.8;
    font-weight: 500;
}

/* Opis zgłoszenia */
.report-description {
    cursor: pointer;
    max-width: 200px;
    font-size: 0.9rem;
    line-height: 1.3;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.report-description:hover {
    background: var(--hover-bg);
}

.full-description {
    white-space: pre-wrap;
    padding: 0.5rem;
    background: var(--hover-bg);
    border-radius: 4px;
    margin-top: 0.5rem;
    max-width: 300px;
}

/* Szczegóły zgłoszenia */
.report-date {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.85rem;
}

.report-user {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.report-phone {
    color: var(--text-color);
    opacity: 0.7;
    font-size: 0.8rem;
}

.report-location {
    margin-top: 0.25rem;
}

/* NAPRAWIONE: Style dla numerów stacji */
.station-number {
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid var(--primary-color);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-block;
}

.station-number:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.coordinates-link {
    color: var(--primary-color);
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
    transition: all 0.2s ease;
}

.coordinates-link:hover {
    color: var(--primary-dark);
    background: rgba(0, 102, 204, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    text-decoration: none;
}

.no-location {
    color: var(--text-color);
    opacity: 0.5;
    font-size: 0.8rem;
    font-style: italic;
}

/* Załączniki w tabeli */
.attachments-summary {
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.attachments-summary:hover {
    transform: scale(1.05);
}

.attachments-count {
    display: block;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.attachments-summary:hover .attachments-count {
    background: var(--primary-dark);
}

.no-attachments {
    color: var(--text-color);
    opacity: 0.6;
    font-style: italic;
    font-size: 0.9rem;
}

/* NAPRAWIONE STATUSY */
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.clickable-status {
    cursor: pointer;
    border: 1px solid currentColor;
}

.clickable-status:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.status-new {
    background: #fff3cd;
    color: #856404;
}

.status-transferred {
    background: #d4edda;
    color: #155724;
}

.status-outdated {
    background: #f8d7da;
    color: #721c24;
}

.status-error_test {
    background: #e2e3e5;
    color: #383d41;
}

/* Modal statusu */
.status-modal-content {
    width: 400px;
    max-width: 90vw;
}

.status-options {
    display: grid;
    gap: 0.5rem;
}

.status-option {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.status-option:hover {
    border-color: var(--primary-color);
    background: var(--hover-bg);
}

.status-option.current {
    border-color: var(--success-color);
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    font-weight: 600;
}

/* Modale */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

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

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.7;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-body {
    padding: 1.5rem;
}

/* MODAL ZAŁĄCZNIKÓW - z przyciskami pobierz */
.attachments-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
}

.attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    max-height: 70vh;
    overflow-y: auto;
}

.attachment-large {
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background: var(--hover-bg);
    transition: all 0.2s ease;
}

.attachment-large:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow);
}

.attachment-large img {
    max-width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.attachment-large img:hover {
    transform: scale(1.05);
}

.attachment-large video {
    max-width: 100%;
    height: auto;
    max-height: 200px;
    border-radius: 4px;
}

.attachment-name {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    word-break: break-word;
    color: var(--text-color);
    opacity: 0.8;
}

.file-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    opacity: 0.5;
}

.file-info {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.6;
    margin-top: 0.25rem;
}

/* NOWE: Style dla akcji załączników */
.attachment-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

.attachment-error {
    text-align: center;
    padding: 1rem;
    color: var(--text-color);
    opacity: 0.7;
}

/* Modal pełnoekranowego zdjęcia z przyciskiem pobierz */
.image-fullscreen-content {
    width: 90vw;
    height: 90vh;
}

.image-fullscreen-content .modal-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: calc(90vh - 80px);
}

/* NOWE: Akcje w pełnoekranowym podglądzie */
.fullscreen-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

/* Map modal */
.map-container {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.map-controls {
    display: flex;
    gap: 1rem;
}

.map-controls button {
    flex: 1;
}

/* Powiadomienia */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    padding: 1rem;
    z-index: 3000;
    max-width: 300px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification.error {
    border-left: 4px solid var(--danger-color);
}

.notification.warning {
    border-left: 4px solid var(--warning-color);
}

.notification.info {
    border-left: 4px solid var(--info-color);
}

.notification-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.7;
    margin-left: 1rem;
}

/* Brak zgłoszeń */
.no-reports {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-color);
    opacity: 0.8;
}

.no-reports-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.no-reports h3 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.no-reports p {
    margin-bottom: 2rem;
}

/* Loading message */
.loading-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: var(--text-color);
    opacity: 0.8;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0,102,204,0.3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner.small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Responsywność */
@media (max-width: 768px) {
    .screen {
        padding: 10px;
    }

    .form-card {
        padding: 1.5rem;
    }

    .location-controls {
        flex-direction: column;
    }

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

    .reports-table {
        font-size: 0.9rem;
        min-width: 900px;
    }

    .reports-table th,
    .reports-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.85rem;
    }

    .modal-content {
        max-width: 95vw;
        margin: 10px;
    }

    .attachments-grid {
        grid-template-columns: 1fr;
    }

    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }

    .notification.show {
        transform: translateY(0);
    }

    .btn-download {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

@media (max-width: 480px) {
    .mevo-logo {
        font-size: 2rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .nav-icon {
        font-size: 1.2rem;
    }

    .nav-label {
        font-size: 0.7rem;
    }

    .reports-table {
        min-width: 950px;
    }

    .station-number {
        font-size: 0.8rem;
        padding: 0.15rem 0.4rem;
    }

    .btn-download {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    .attachment-actions {
        margin-top: 0.5rem;
    }

    .fullscreen-actions {
        margin-top: 0.5rem;
    }
}
