/* LASG Theme v13.0 - "Obsidian Glass" (Dashboard Final) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    box-sizing: border-box;
}

:root {
    --obsidian-bg: #030712;
    --obsidian-card: rgba(17, 24, 39, 0.7);
    --obsidian-border: rgba(255, 255, 255, 0.08);
    --obsidian-input: rgba(255, 255, 255, 0.03);

    --neon-orange: #f97316;
    --neon-blue: #3b82f6;
    --neon-green: #22c55e;
    --neon-red: #ef4444;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;

    --radius-lg: 24px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

/* 1. GLOBAL RESET */
html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text-primary);
    background-color: var(--obsidian-bg);
    overflow-x: hidden !important;
    max-width: 100vw;
    line-height: 1.5;
}

/* 2. NUCLEAR MODE (Hide WordPress Header/Footer if needed) */
header,
footer,
#wpadminbar,
.site-header,
.site-footer {
    display: none !important;
}

/* 3. FORM CONTAINER (Registration) */
.lasg-form-container {
    width: 100%;
    max-width: 600px;
    margin: 40px auto;
    background: var(--obsidian-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--obsidian-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.lasg-form-container h3,
.lasg-form-container h4 {
    color: white;
    font-weight: 600;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--obsidian-border);
    padding-bottom: 10px;
}

/* 4. INPUTS */
input[type="text"],
input[type="file"],
select {
    width: 100%;
    background: var(--obsidian-input);
    border: 1px solid var(--obsidian-border);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    box-sizing: border-box;
    transition: all 0.2s;
    outline: none;
}

input:focus {
    border-color: var(--neon-orange);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

/* 5. UPLOAD BOXES */
#uploadSection,
#crlv-upload-container,
#uploadCnpjSection {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.3s;
}

#uploadSection:hover {
    border-color: var(--neon-orange);
    background: rgba(249, 115, 22, 0.05);
}

/* 6. PRIMARY BUTTONS (Form) */
button {
    /* Default button reset for form */
    font-family: inherit;
    cursor: pointer;
}

#btnConfirmCNH,
#btnConfirmCRLV,
#btnGoToCnpj,
#btnGoToReview,
#btnConcluirFinal {
    width: 100%;
    padding: 16px;
    background: var(--neon-orange);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 16px;
    margin-top: 20px;
    transition: transform 0.1s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#btnConfirmCNH:hover,
#btnConfirmCRLV:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* --- DASHBOARD STYLES (New) --- */

.lasg-dashboard-container {
    width: 100%;
    /* Full Width */
    max-width: 1600px;
    margin: 40px auto;
    padding: 0 20px;
}

.lasg-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 24px 32px;
    background: var(--obsidian-card);
    border: 1px solid var(--obsidian-border);
    border-radius: var(--radius-lg);
}

.lasg-dashboard-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.lasg-badge-count {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 12px;
    color: #e2e8f0;
    backdrop-filter: blur(4px);
}

/* SEARCH BOX */
.lasg-search-box input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px 16px;
    border-radius: 99px;
    width: 250px;
    font-size: 13px;
    transition: all 0.2s;
}

.lasg-search-box input:focus {
    width: 300px;
    /* Expand on focus */
    border-color: var(--neon-blue);
    background: rgba(0, 0, 0, 0.3);
    outline: none;
}

/* PAGINATION */
.lasg-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--obsidian-border);
}

.lasg-pagination button {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    width: auto !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.lasg-pagination button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--neon-blue) !important;
}

.lasg-pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lasg-pagination span {
    font-size: 13px;
    color: var(--text-secondary);
}

.lasg-table-wrapper {
    background: var(--obsidian-card);
    border: 1px solid var(--obsidian-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    /* Rounded corners clip */
    overflow-x: auto;
}

.lasg-drivers-table {
    width: 100%;
    border-collapse: collapse;
    white-space: normal;
    /* Allow wrapping to save space */
}

.lasg-drivers-table th {
    background: rgba(0, 0, 0, 0.2);
    padding: 16px 12px;
    /* Reduced from 24px to save space */
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--obsidian-border);
}

.lasg-drivers-table td {
    padding: 14px 12px;
    /* Reduced from 24px to save space */
    border-bottom: 1px solid var(--obsidian-border);
    color: var(--text-primary);
    vertical-align: middle;
    font-size: 14px;
    transition: background 0.15s;
}

.lasg-drivers-table tr:last-child td {
    border-bottom: none;
}

.lasg-drivers-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* COLUMNS */
.col-id {
    color: var(--text-secondary);
    font-family: monospace;
}

.col-name strong {
    display: block;
    font-size: 15px;
    color: white;
}

.col-date {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
}

.lasg-btn-bulk-delete {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    padding: 6px 16px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
    margin-left: 15px !important;
    transition: all 0.2s;
    width: auto !important;
    box-shadow: none !important;
}

.lasg-btn-bulk-delete:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    border-color: #ef4444 !important;
    transform: translateY(-1px);
}

/* ACTION BUTTONS (Small & Clean) */

/* 1. Add Button (+ ID / + Email) */
.lasg-btn-action-add {
    background: transparent !important;
    border: 1px dashed var(--obsidian-border) !important;
    color: var(--text-secondary) !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    margin: 0 !important;
    width: auto !important;
    display: inline-block;
    transition: all 0.2s;
}

.lasg-btn-action-add:hover {
    border-color: var(--neon-blue) !important;
    color: var(--neon-blue) !important;
    background: rgba(59, 130, 246, 0.1) !important;
    transform: translateY(0) !important;
    /* Reset generic jump */
    box-shadow: none !important;
}

/* 2. Value Pill (Already added) */
.lasg-value-pill {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 99px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    /* Prevent badge wrapping */
}

.lasg-value-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* 3. Icon Buttons (Detail / Delete) */
.col-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.lasg-btn-icon {
    background: transparent !important;
    /* Override global button */
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    transition: all 0.2s;
    opacity: 0.7;
}

.lasg-btn-detail:hover {
    background: rgba(59, 130, 246, 0.2) !important;
    color: var(--neon-blue) !important;
    opacity: 1;
}

.lasg-btn-delete:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    color: var(--neon-red) !important;
    opacity: 1;
}

/* 4. WhatsApp Button */
.lasg-btn-whatsapp-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border-radius: 8px;
    border: 1px solid rgba(34, 197, 94, 0.2);
    text-decoration: none;
    transition: all 0.2s;
}

.lasg-btn-whatsapp-icon:hover {
    background: rgba(34, 197, 94, 0.2);
    transform: scale(1.05);
}

.no-phone {
    opacity: 0.3;
}

/* STATUS */
.lasg-status {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    /* Prevent badge wrapping */
}

.lasg-status-novo {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
}

.lasg-status-concluido {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}

.lasg-status-pendente {
    background: rgba(250, 204, 21, 0.1);
    color: #facc15;
}

.lasg-status-completa {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}

.lasg-status-incompleta {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

/* MODALS */
.lasg-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

/* Display flex when visible via JS inline style */

.lasg-modal-content {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

.lasg-modal-lg {
    max-width: 800px;
    /* Wider for details */
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.lasg-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s;
}

.lasg-close:hover {
    color: white;
}

.lasg-input-modal {
    margin: 20px 0;
    background: #1f2937 !important;
    /* Darker input */
}

.lasg-btn-save {
    width: 100%;
    padding: 12px;
    background: var(--neon-blue) !important;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
}

.lasg-btn-save:hover {
    background: #2563eb !important;
}

/* Detail Grid */
.lasg-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
    text-align: left;
}

.detail-item label {
    display: block;
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
}

.detail-item span {
    display: block;
    font-size: 14px;
    color: white;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 4px;
    margin-top: 4px;
}

.full-width {
    grid-column: span 2;
}

/* --- RESPONSIVENESS (MOBILE) --- */

@media (max-width: 1024px) {
    .lasg-dashboard-container {
        padding: 0 10px;
    }
}

@media (max-width: 768px) {

    /* Form & Global */
    .lasg-form-container {
        padding: 20px;
        margin: 10px;
    }

    /* Grids Stacking */
    #cnhFieldsPreview,
    #crlv-conference-fields,
    #step-comodato div,
    #step-cnpj div,
    .lasg-detail-grid {
        grid-template-columns: 1fr !important;
    }

    .full-width {
        grid-column: span 1 !important;
    }

    /* Dashboard Header */
    .lasg-dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        padding: 20px;
    }

    .lasg-table-wrapper {
        overflow-x: hidden !important;
        border: none;
        background: transparent;
    }

    .lasg-drivers-table {
        word-break: break-word;
    }

    .lasg-search-box input {
        width: 100% !important;
    }

    /* TABLE TO CARDS (The Magic Trick) */
    .lasg-drivers-table thead {
        display: none;
        /* Hide headers on mobile */
    }

    .lasg-drivers-table,
    .lasg-drivers-table tbody,
    .lasg-drivers-table tr,
    .lasg-drivers-table td {
        display: block;
        width: 100%;
    }

    .lasg-drivers-table tr {
        margin-bottom: 20px;
        border: 1px solid var(--obsidian-border);
        border-radius: var(--radius-md);
        background: rgba(255, 255, 255, 0.02);
        padding: 15px;
    }

    .lasg-drivers-table td {
        border: none;
        padding: 10px 0;
        text-align: left;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        /* CRITICAL */
        gap: 8px;
        min-width: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .lasg-drivers-table td:last-child {
        border-bottom: none;
    }

    /* Label Injection for Mobile Cards */
    .lasg-drivers-table td::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 600;
        color: var(--text-secondary);
        text-transform: uppercase;
        flex-shrink: 0;
    }

    /* Value alignment in cards */
    .lasg-drivers-table td>*:not(::before) {
        max-width: 100%;
        text-align: right;
    }

    /* Special alignments for values */
    .col-id,
    .col-whatsapp {
        justify-content: space-between;
    }

    .col-name strong {
        text-align: right;
        font-size: 14px;
        word-break: break-word;
        /* Allow long names to wrap */
    }

    /* Actions positioning on mobile */
    .col-actions {
        justify-content: flex-end;
    }

    /* Modal adjustments */
    .lasg-modal-content {
        padding: 20px;
        width: calc(100% - 20px);
        margin: 10px auto;
    }

    .lasg-detail-grid .detail-item label {
        margin-bottom: 2px;
    }
}

@media (max-width: 480px) {
    .lasg-drivers-table td {
        flex-direction: column;
        /* Stack on very narrow screens */
        align-items: flex-start;
        gap: 4px;
    }

    .lasg-drivers-table td::before {
        margin-bottom: 2px;
    }

    .lasg-drivers-table td>*:not(::before) {
        text-align: left;
        width: 100%;
    }

    .col-name strong {
        text-align: left;
    }

    .lasg-pagination {
        flex-direction: column;
        gap: 10px;
    }

    .lasg-pagination button {
        width: 100% !important;
    }
}