/* global reset */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ff5722 0%, #ff7043 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: #ffffff;
}

header {
    background-color: #ff5722;
    color: #ffffff;
    padding: 15px 20px;
    font-size: 24px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 8px 8px;
}

header h2 {
    margin: 0;
    font-size: 28px;
}

nav {
    display: flex;
    gap: 15px;
}

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

.header-nav a {
    color: #ffffff;
    text-decoration: none;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.header-nav a:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

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

.hamburger-menu {
    position: relative;
}

.hamburger-menu summary {
    list-style: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    user-select: none;
}

.hamburger-menu summary::-webkit-details-marker {
    display: none;
}

.hamburger-menu summary:hover {
    background: rgba(255, 255, 255, 0.35);
}

.hamburger-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    background: #fff3e0;
    color: #ff5722;
    border: 2px solid #ffab91;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
    z-index: 30;
    padding: 10px;
}

.hamburger-dropdown a {
    display: block;
    margin: 6px 0;
    padding: 10px 12px;
    border-radius: 10px;
    color: #ff5722;
    font-weight: 700;
    text-decoration: none;
    background: #ffe0b2;
}

.hamburger-dropdown .menu-item-disabled {
    display: block;
    margin: 6px 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f4d6cc;
    color: #b97962;
    font-weight: 700;
    cursor: not-allowed;
    opacity: 0.85;
}

.hamburger-dropdown a:hover {
    background: #ffd180;
}

.hamburger-divider {
    height: 1px;
    background: #ffab91;
    margin: 8px 0;
}

.hamburger-label {
    display: block;
    font-size: 12px;
    color: #b74a2c;
    margin-bottom: 6px;
    font-weight: 700;
}

.chat-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.2px;
    z-index: 60;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.chat-panel {
    position: fixed;
    right: 22px;
    bottom: 92px;
    width: min(92vw, 360px);
    max-height: min(70vh, 520px);
    background: #fff3e0;
    border: 2px solid #ffab91;
    border-radius: 16px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
    z-index: 61;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-hidden {
    display: none;
}

.chat-header {
    padding: 10px 12px;
    background: #ff5722;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.chat-header strong {
    font-size: 14px;
}

.chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    border-radius: 10px;
    padding: 6px 8px;
    cursor: pointer;
    font-weight: 700;
}

.chat-list {
    list-style: none;
    margin: 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
}

.chat-list li {
    margin: 0;
    padding: 8px 10px;
    border-left: none;
    border-radius: 10px;
    background: #ffe0b2;
    color: #bf360c;
}

.chat-list li.mine {
    background: #ffccbc;
}

.chat-meta {
    display: block;
    font-size: 11px;
    opacity: 0.85;
    margin-bottom: 4px;
    font-weight: 700;
}

.chat-form {
    border-top: 1px solid #ffab91;
    padding: 10px;
    background: #fff8ee;
    display: flex;
    gap: 8px;
}

.chat-form input {
    flex: 1;
    margin: 0;
    min-width: 0;
}

.chat-form button {
    margin: 0;
    padding: 10px 14px;
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
}

.docas-menu {
    position: relative;
}

.docas-menu summary {
    list-style: none;
    color: #ffffff;
    text-decoration: none;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-weight: bold;
    transition: background-color 0.3s;
    cursor: pointer;
}

.docas-menu summary::-webkit-details-marker {
    display: none;
}

.docas-menu summary:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.docas-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 260px;
    max-width: 420px;
    background: #fff3e0;
    color: #ff5722;
    border: 2px solid #ffab91;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    z-index: 20;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.container {
    background: linear-gradient(135deg, #fff3e0 0%, #ffd180 100%);
    padding: 30px 40px;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(255, 87, 34, 0.15);
    max-width: 720px;
    margin: 40px auto;
    color: #ff5722;
    border: 2px solid #ff7043;
}

h1 {
    color: #ff5722;
    margin-bottom: 20px;
    font-weight: 900;
    letter-spacing: 1px;
}

.login-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    position: relative;
}

.login-title-row h1 {
    margin: 0;
}

.login-help {
    position: relative;
}

.login-help summary {
    list-style: none;
    width: 23px;
    height: 23px;
    border-radius: 50%;
    border: 1.5px solid #ff7043;
    background: #fff3e0;
    color: #ff5722;
    font-weight: 900;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.login-help summary::-webkit-details-marker {
    display: none;
}

.login-help summary:hover,
.login-help summary:focus {
    background: #ffd180;
}

.login-help-card {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: min(265px, 72vw);
    background: #fff3e0;
    color: #bf360c;
    border: 1.5px solid #ffab91;
    border-radius: 9px;
    padding: 8px 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    font-size: 12px;
    line-height: 1.3;
    z-index: 12;
    display: none;
}

.login-help:hover .login-help-card,
.login-help:focus-within .login-help-card,
.login-help[open] .login-help-card {
    display: block;
}

.container nav a,
.container p a,
button {
    color: #ffffff;
    text-decoration: none;
    padding: 10px 18px;
    background: linear-gradient(90deg, #ff5722 60%, #ff7043 100%);
    border: none;
    border-radius: 24px;
    font-weight: bold;
    transition: background 0.3s, transform 0.2s;
    display: inline-block;
    margin: 6px 6px 6px 0;
    cursor: pointer;
}

.container nav a:hover,
.container p a:hover,
button:hover {
    background: linear-gradient(90deg, #e64a19 60%, #ff7043 100%);
    transform: translateY(-2px);
}

button:disabled {
    opacity: 0.78;
    cursor: wait;
    transform: none;
}

.submit-status {
    margin: 10px 0 18px;
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 700;
    line-height: 1.4;
    border: 1px solid transparent;
}

.submit-status[data-state="queued"],
.submit-status[data-state="processing"] {
    background: #fff3cd;
    border-color: #ffe08a;
    color: #8a5a00;
}

.submit-status[data-state="success"] {
    background: #dff6e5;
    border-color: #7ad39b;
    color: #1d6b39;
}

.submit-status[data-state="error"] {
    background: #ffe0e0;
    border-color: #ff9b9b;
    color: #a11d1d;
}

.is-loading {
    position: relative;
}

.autocomplete-sugestoes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 6px 0 12px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #ffab91;
    border-radius: 10px;
    background: #fff8ee;
}

.autocomplete-item {
    width: 100% !important;
    margin: 0 !important;
    padding: 9px 10px !important;
    text-align: left;
    border-radius: 8px;
    background: #ffe0b2 !important;
    color: #bf360c !important;
    border: 1px solid #ffc48f !important;
    font-size: 14px;
}

.autocomplete-item:hover {
    background: #ffd180 !important;
}

form label {
    display: block;
    text-align: left;
    margin-top: 10px;
    font-weight: 600;
}

form input[type="text"],
form input[type="password"],
form input[type="number"],
form select,
form textarea {
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    border: 2px solid #ffab91;
    border-radius: 8px;
    background: #fff3e0;
    color: #ff5722;
    font-size: 16px;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
}

form input[type="text"]:focus,
form input[type="password"]:focus,
form input[type="number"]:focus,
form select:focus,
form textarea:focus {
    border: 2px solid #ff5722;
    box-shadow: 0 0 0 2px #ffab91;
}

.filtro-motorista-form {
    margin: 14px 0 18px;
}

.login-page header {
    justify-content: center;
    position: relative;
}

.login-page header h2 {
    width: 100%;
    text-align: center;
}

.login-page .login-theme-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px !important;
    height: 40px !important;
    min-width: 40px;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
}

.login-page .login-admin {
    margin: -12px auto 22px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff3e0;
}

.table-action-form {
    margin: 0;
}

.btn-small {
    width: auto !important;
    padding: 8px 12px !important;
    font-size: 13px;
    margin: 0;
}

.add-motorista-page .btn-clear-filtros {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    margin-left: 8px;
    border-radius: 24px;
    min-height: 36px;
    border: none;
    background: linear-gradient(90deg, #ff5722 60%, #ff7043 100%);
    color: #ffffff;
    transition: background 0.3s, transform 0.2s;
}

.add-motorista-page .btn-clear-filtros:hover {
    background: linear-gradient(90deg, #e64a19 60%, #ff7043 100%);
}

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

table td,
table th {
    border: 1px solid #ddd;
    padding: 8px;
}

table tr:nth-child(even) {
    background-color: #ffe0b2;
}

table tr:hover {
    background-color: #ffd180;
}

table th {
    background-color: #ff5722;
    color: #ffffff;
    text-align: left;
}

/* Responsive table wrapper */
.table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid #ffab91;
    border-radius: 10px;
    background: #fff3e0;
    margin: 20px 0;
}

.dados-docas-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
}

.dados-docas-table td,
.dados-docas-table th {
    padding: 12px 10px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.add-motorista-page .table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid #ffab91;
    border-radius: 10px;
    background: #fff3e0;
}

.add-motorista-page .motorista-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.add-motorista-page .motorista-table td,
.add-motorista-page .motorista-table th {
    white-space: nowrap;
}

ul {
    list-style-type: none;
    padding: 0;
}

ul li {
    background: #fff3e0;
    margin: 6px 0;
    padding: 10px;
    border-left: 4px solid #ff5722;
    color: #ff5722;
}

/* dark mode completo */
html.dark-mode,
body.dark-mode {
    background: #111111 !important;
    color: #f5f5f5;
}

html.dark-mode header,
body.dark-mode header {
    background: #1a1a1a;
    color: #f5f5f5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
}

html.dark-mode .header-nav a,
body.dark-mode .header-nav a {
    background: #2a2a2a;
    color: #f5f5f5;
}

html.dark-mode .hamburger-menu summary,
body.dark-mode .hamburger-menu summary {
    background: #2a2a2a;
    color: #f5f5f5;
}

html.dark-mode .hamburger-menu summary:hover,
body.dark-mode .hamburger-menu summary:hover {
    background: #3a3a3a;
}

html.dark-mode .hamburger-dropdown,
body.dark-mode .hamburger-dropdown {
    background: #1f1f1f;
    color: #f5f5f5;
    border-color: #3a3a3a;
}

html.dark-mode .hamburger-dropdown a,
body.dark-mode .hamburger-dropdown a {
    background: #2a2a2a;
    color: #f5f5f5;
}

html.dark-mode .hamburger-dropdown .menu-item-disabled,
body.dark-mode .hamburger-dropdown .menu-item-disabled {
    background: #2b2b2b;
    color: #9a9a9a;
}

html.dark-mode .hamburger-dropdown a:hover,
body.dark-mode .hamburger-dropdown a:hover {
    background: #343434;
}

html.dark-mode .hamburger-divider,
body.dark-mode .hamburger-divider {
    background: #3a3a3a;
}

html.dark-mode .hamburger-label,
body.dark-mode .hamburger-label {
    color: #c7c7c7;
}

html.dark-mode .chat-panel,
body.dark-mode .chat-panel {
    background: #1f1f1f;
    border-color: #3a3a3a;
}

html.dark-mode .chat-header,
body.dark-mode .chat-header {
    background: #2b2b2b;
}

html.dark-mode .chat-close,
body.dark-mode .chat-close {
    background: #3a3a3a;
}

html.dark-mode .chat-list li,
body.dark-mode .chat-list li {
    background: #2a2a2a;
    color: #f5f5f5;
}

html.dark-mode .chat-list li.mine,
body.dark-mode .chat-list li.mine {
    background: #343434;
}

html.dark-mode .chat-form,
body.dark-mode .chat-form {
    background: #202020;
    border-top-color: #3a3a3a;
}

@media (max-width: 840px) {
    header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .header-nav {
        width: 100%;
        order: 3;
    }

    .container {
        margin: 20px 14px 90px;
        padding: 20px 16px;
        max-width: none;
    }

    .chat-fab {
        right: 14px;
        bottom: 14px;
        width: 54px;
        height: 54px;
    }

    .chat-panel {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 78px;
        max-height: 62vh;
    }
}

@media (max-width: 768px) {
    header {
        padding: 12px 12px;
    }

    header h2 {
        font-size: 20px;
    }

    .header-nav {
        display: none;
    }

    .header-actions {
        margin-left: auto;
    }

    h1 {
        font-size: 28px;
        line-height: 1.2;
        margin-bottom: 14px;
    }

    .container nav a,
    .container p a,
    button {
        width: 100%;
        text-align: center;
        margin-right: 0;
    }

    .login-page .login-theme-toggle {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px;
        right: 10px;
    }

    .chat-form button {
        width: auto;
    }

    .filtro-motorista-form button,
    .table-action-form .btn-small {
        width: auto !important;
    }

    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        border-collapse: separate;
    }

    table td,
    table th {
        min-width: 88px;
    }

    .docas-dropdown,
    .hamburger-dropdown {
        right: 0;
        left: auto;
        width: min(90vw, 300px);
    }
}

@media (max-width: 480px) {
    .container {
        margin: 14px 10px 82px;
        padding: 16px 12px;
        border-radius: 12px;
    }

    .chat-header strong {
        font-size: 13px;
    }

    .chat-close {
        padding: 5px 7px;
        font-size: 12px;
    }
}

html.dark-mode .docas-menu summary,
body.dark-mode .docas-menu summary {
    background: #2a2a2a;
    color: #f5f5f5;
}

html.dark-mode .docas-menu summary:hover,
body.dark-mode .docas-menu summary:hover {
    background: #3a3a3a;
}

html.dark-mode .docas-dropdown,
body.dark-mode .docas-dropdown {
    background: #222;
    color: #f5f5f5;
    border-color: #3a3a3a;
}

html.dark-mode .header-nav a:hover,
body.dark-mode .header-nav a:hover {
    background: #3a3a3a;
}

html.dark-mode .container,
body.dark-mode .container {
    background: #181818;
    color: #f5f5f5;
    border: 2px solid #2b2b2b;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.65);
}

html.dark-mode .login-help summary,
body.dark-mode .login-help summary {
    background: #222222;
    color: #f5f5f5;
    border-color: #444444;
}

html.dark-mode .login-help summary:hover,
body.dark-mode .login-help summary:hover,
html.dark-mode .login-help summary:focus,
body.dark-mode .login-help summary:focus {
    background: #2f2f2f;
}

html.dark-mode .login-help-card,
body.dark-mode .login-help-card {
    background: #212121;
    color: #f5f5f5;
    border-color: #3a3a3a;
}

html.dark-mode .login-page .login-admin,
body.dark-mode .login-page .login-admin {
    color: #d9d9d9;
}

html.dark-mode h1,
body.dark-mode h1,
html.dark-mode h2,
body.dark-mode h2,
html.dark-mode label,
body.dark-mode label,
html.dark-mode p,
body.dark-mode p,
html.dark-mode li,
body.dark-mode li,
html.dark-mode td,
body.dark-mode td,
html.dark-mode th,
body.dark-mode th {
    color: #f5f5f5;
}

html.dark-mode .container nav a,
body.dark-mode .container nav a,
html.dark-mode .container p a,
body.dark-mode .container p a,
html.dark-mode button,
body.dark-mode button {
    background: linear-gradient(90deg, #262626 60%, #363636 100%);
    color: #f5f5f5;
}

html.dark-mode .container nav a:hover,
body.dark-mode .container nav a:hover,
html.dark-mode .container p a:hover,
body.dark-mode .container p a:hover,
html.dark-mode button:hover,
body.dark-mode button:hover {
    background: linear-gradient(90deg, #333333 60%, #454545 100%);
}

html.dark-mode input,
body.dark-mode input,
html.dark-mode select,
body.dark-mode select,
html.dark-mode textarea,
body.dark-mode textarea {
    background: #222222;
    color: #f5f5f5;
    border: 2px solid #444444;
}

html.dark-mode input:focus,
body.dark-mode input:focus,
html.dark-mode select:focus,
body.dark-mode select:focus,
html.dark-mode textarea:focus,
body.dark-mode textarea:focus {
    border-color: #ff5722;
    box-shadow: 0 0 0 2px #333333;
}

html.dark-mode table,
body.dark-mode table {
    background: #181818;
}

html.dark-mode table td,
body.dark-mode table td,
html.dark-mode table th,
body.dark-mode table th {
    border-color: #2f2f2f;
}

html.dark-mode table tr:nth-child(even),
body.dark-mode table tr:nth-child(even) {
    background: #202020;
}

html.dark-mode table tr:hover,
body.dark-mode table tr:hover {
    background: #2a2a2a;
}

html.dark-mode table th,
body.dark-mode table th {
    background: #262626;
}

html.dark-mode .add-motorista-page .table-wrapper,
body.dark-mode .add-motorista-page .table-wrapper {
    background: #181818;
    border-color: #2f2f2f;
}

html.dark-mode .add-motorista-page .btn-clear-filtros,
body.dark-mode .add-motorista-page .btn-clear-filtros {
    background: transparent;
    color: #f5f5f5;
    border-color: #666666;
}

html.dark-mode .add-motorista-page .btn-clear-filtros:hover,
body.dark-mode .add-motorista-page .btn-clear-filtros:hover {
    background: #343434;
    color: #ffffff;
}

html.dark-mode ul li,
body.dark-mode ul li {
    background: #212121;
    border-left-color: #ff5722;
}

html.dark-mode .submit-status[data-state="queued"],
body.dark-mode .submit-status[data-state="queued"],
html.dark-mode .submit-status[data-state="processing"],
body.dark-mode .submit-status[data-state="processing"] {
    background: #3a3214;
    border-color: #67581f;
    color: #ffe69a;
}

html.dark-mode .submit-status[data-state="success"],
body.dark-mode .submit-status[data-state="success"] {
    background: #173725;
    border-color: #2d7c52;
    color: #9ce0b5;
}

html.dark-mode .submit-status[data-state="error"],
body.dark-mode .submit-status[data-state="error"] {
    background: #3c1818;
    border-color: #8d3030;
    color: #ffb0b0;
}

html.dark-mode .autocomplete-sugestoes,
body.dark-mode .autocomplete-sugestoes {
    background: #1f1f1f;
    border-color: #3a3a3a;
}

html.dark-mode .autocomplete-item,
body.dark-mode .autocomplete-item {
    background: #2a2a2a !important;
    color: #f5f5f5 !important;
    border-color: #3e3e3e !important;
}

html.dark-mode .autocomplete-item:hover,
body.dark-mode .autocomplete-item:hover {
    background: #343434 !important;
}

html.dark-mode ::-webkit-scrollbar,
body.dark-mode ::-webkit-scrollbar {
    width: 10px;
    background: #151515;
}

html.dark-mode ::-webkit-scrollbar-thumb,
body.dark-mode ::-webkit-scrollbar-thumb {
    background: #383838;
    border-radius: 8px;
}

html.dark-mode ::-webkit-scrollbar-thumb:hover,
body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}