:root {
    --primary-color: #1e88e5;
    --danger-color: #e53935;
    --background-color: #f5f9ff;
    --card-bg: #fff;
    --text-dark: #2c3e50;
    --text-muted: #7f8c8d;
    --shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--background-color);
    color: #333;
}

.app-header {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    text-align: center;
}

.logo-link {
    display: block;
    cursor: pointer;
}

.logo {
    height: 80px;
}

.welcome-container {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: var(--text-muted);
}

/* Invoices page */
.invoices-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.invoices-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e5eb;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-info h2 {
    margin: 0;
    color: var(--text-dark);
}

.icon-user {
    color: var(--text-dark);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 16px;
}

.loading.hidden {
    display: none;
}

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

/* PDF Card */
.pdf-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    position: relative;
}

.pdf-card:hover {
    transform: translateY(-5px);
}

.pdf-preview {
    height: 180px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    background-color: #f5f5f5;
}

.pdf-details {
    padding: 15px;
}

.pdf-details h3 {
    margin: 0 0 5px;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-details p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

/* Action buttons on cards */
.card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
}

.download-btn,
.delete-btn {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
}

.download-btn {
    color: #3498db;
}

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

.download-btn:hover,
.delete-btn:hover {
    background: #fff;
}

.download-btn svg,
.delete-btn svg {
    width: 18px;
    height: 18px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-primary:hover {
    background: #1565c0;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #bdbdbd;
}

.admin-actions {
    display: flex;
    gap: 8px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
    background: #f0f0f0;
}

.modal-content h3 {
    margin: 0 0 10px;
    padding-right: 30px;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.url-box {
    display: flex;
    gap: 8px;
}

.url-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
}

/* Password screen */
.password-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.password-box {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 32px;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 360px;
    width: 90%;
}

.password-box h3 {
    margin: 0 0 8px;
    color: var(--text-dark);
}

.password-box p {
    color: var(--text-muted);
    margin-bottom: 16px;
    font-size: 14px;
}

.password-form {
    display: flex;
    gap: 8px;
}

.password-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Vehicle info line */
.vehicle-info-line {
    color: var(--text-dark);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 16px;
    padding: 10px 0;
}

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

.empty-state svg {
    margin-bottom: 16px;
    color: #ccc;
}

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

/* PDF Viewer overlay */
.pdf-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.pdf-viewer-overlay.hidden {
    display: none;
}

.pdf-viewer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #1a1a1a;
    color: #fff;
    flex-shrink: 0;
}

.pdf-viewer-bar span {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin: 0 12px;
}

.pdf-viewer-bar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.pdf-viewer-bar button,
.pdf-viewer-bar a {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: #fff;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
}

.pdf-viewer-bar button:hover,
.pdf-viewer-bar a:hover {
    background: rgba(255, 255, 255, 0.25);
}

.pdf-viewer-frame {
    flex: 1;
    border: none;
    width: 100%;
}

.pdf-viewer-pages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #333;
    padding: 8px 0;
}

.pdf-page-img {
    display: block;
    width: 100%;
    margin: 0 auto 8px;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 600px) {
    .app-header {
        padding: 8px 0;
    }

    .logo {
        height: 50px;
    }

    .invoices-container {
        padding: 12px;
    }

    .invoices-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

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

    .admin-actions {
        width: 100%;
    }

    .admin-actions .btn {
        flex: 1;
        justify-content: center;
    }

    /* Card grid — single column */
    .pdfs-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    /* Card — vertical layout, big preview on top */
    .pdf-card {
        border-radius: 12px;
    }

    .pdf-card:hover {
        transform: none;
    }

    .pdf-preview {
        height: 220px;
    }

    .pdf-card-body {
        display: flex;
        align-items: center;
        padding: 12px 14px;
        gap: 10px;
    }

    .pdf-details {
        flex: 1;
        padding: 0;
        min-width: 0;
    }

    .pdf-details h3 {
        font-size: 16px;
    }

    .pdf-details p {
        font-size: 13px;
    }

    /* Action buttons — always visible, beside text */
    .card-actions {
        position: static;
        display: flex;
        gap: 8px;
        flex-shrink: 0;
    }

    .download-btn,
    .delete-btn {
        width: 42px;
        height: 42px;
        box-shadow: none;
        background: #f0f4f8;
        border-radius: 10px;
    }

    .download-btn:hover,
    .delete-btn:hover {
        background: #e0e8f0;
    }

    /* Password screen mobile */
    .password-container {
        min-height: 50vh;
        padding: 0 16px;
    }

    .password-box {
        padding: 24px 20px;
    }

    .password-form {
        flex-direction: column;
    }

    .password-form input {
        width: 100%;
        text-align: center;
        font-size: 18px;
        padding: 12px;
    }

    .password-form .btn {
        width: 100%;
        justify-content: center;
        padding: 12px;
        font-size: 16px;
    }

    /* Modal mobile */
    .modal-content {
        margin: 0 12px;
        border-radius: 14px;
    }

    .url-box {
        flex-direction: column;
    }

    .url-box input {
        font-size: 12px;
    }

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