/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    font-size: 16px;
}

header {
    background: linear-gradient(135deg, #C49F8C 0%, #A87B67 55%, #7F5B44 100%);
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

.nav-toggle-container {
    display: none;
    align-items: center;
    margin-bottom: 1rem;
}

.nav-toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-right: 1rem;
}

.nav-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.current-section-title {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0 1rem;
    transition: all 0.3s ease;
}

nav button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 120px;
}

nav button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

nav button.active {
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.section {
    display: none;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.appointment-form-inline:not([hidden]) {
    margin: 1.5rem 0;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section h2 {
    margin-bottom: 1.5rem;
    color: #667eea;
    font-size: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.5rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-card {
    background: linear-gradient(135deg, #f8e1d8 0%, #f0c4aa 100%);
    border: 1px solid rgba(196, 159, 140, 0.5);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.dashboard-card .card-label {
    display: block;
    color: #5f4d40;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
}

.dashboard-card strong {
    display: block;
    font-size: 2rem;
    color: #462f20;
}

.dashboard-list-container {
    background: #fff7f2;
    border: 1px solid rgba(196, 159, 140, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
}

.dashboard-list-container h3 {
    margin-bottom: 1rem;
    color: #5f4d40;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

button {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    margin: 0.5rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

button[hidden] {
    display: none;
}

button:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

button:active {
    transform: translateY(0);
}

button.delete {
    background: #e53e3e;
}

button.delete:hover {
    background: #c53030;
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

button.edit {
    background: #38a169;
}

button.edit:hover {
    background: #2f855a;
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.3);
}

button.appointment-complete {
    background: #27845a;
}

button.appointment-complete:hover {
    background: #216b49;
}

button.appointment-reschedule {
    background: #2878a8;
}

button.appointment-reschedule:hover {
    background: #205f85;
}

button.appointment-not-completed {
    background: #b94a48;
}

button.appointment-not-completed:hover {
    background: #963b39;
}

button.load {
    background: #3182ce;
}

button.load:hover {
    background: #2c5282;
}

/* Listas */
.list {
    margin-top: 1rem;
}

.item {
    background: #f7fafc;
    padding: 1.5rem;
    margin: 0.75rem 0;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#dashboard #dashboard-agendamentos-list > .dashboard-appointments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 260px));
    justify-content: start;
    gap: 1rem;
}

#dashboard #dashboard-agendamentos-list > .dashboard-appointments-grid .item {
    aspect-ratio: 1;
    min-width: 0;
    margin: 0;
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
}

#dashboard #dashboard-agendamentos-list > .dashboard-appointments-grid .item:hover {
    transform: translateY(-2px);
}

#dashboard #dashboard-agendamentos-list > .dashboard-appointments-grid .item-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 0.35rem;
}

#dashboard #dashboard-agendamentos-list > .dashboard-appointments-grid .item-actions button {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.5rem 0.35rem;
    font-size: 0.8rem;
}

.item:hover {
    background: #edf2f7;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.item-info {
    flex: 1;
    line-height: 1.5;
}

.item-info strong {
    color: #2d3748;
    font-size: 1.1rem;
}

.item-info br {
    margin-bottom: 0.25rem;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Formulários */
form {
    display: grid;
    gap: 1.25rem;
    max-width: 500px;
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, select {
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

input:focus, select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.autocomplete-results {
    display: grid;
    max-height: 200px;
    overflow-y: auto;
    color: #64748b;
    font-size: 0.9rem;
}

.autocomplete-option {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 0;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0;
    background: #fff;
    color: #334155;
    text-align: left;
    cursor: pointer;
}

.autocomplete-option:hover,
.autocomplete-option:focus-visible {
    background: #f1f5f9;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.pagination[hidden] {
    display: none;
}

.pagination span {
    color: #4a5568;
    font-size: 0.9rem;
}

.pagination button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

input[type="date"], input[type="time"] {
    cursor: pointer;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 95%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #a0aec0;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    color: #e53e3e;
    background: #fed7d7;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

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

/* ==================== RESPONSIVIDADE ==================== */

/* Tablets */
@media (max-width: 1024px) {
    main {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }

    .section {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .modal-content {
        margin: 10% auto;
        width: 90%;
        padding: 1.5rem;
    }
}

/* Tablets pequenos e celulares grandes */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    header {
        padding: 1rem 0.5rem;
    }

    header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    nav {
        gap: 0.25rem;
        padding: 0 0.5rem;
    }

    nav button {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        min-width: 100px;
        flex: 1;
        max-width: calc(50% - 0.25rem);
    }

    main {
        margin: 1rem 0.5rem;
        padding: 0;
    }

    .section {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 8px;
    }

    .section h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    button {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        margin: 0.25rem;
    }

    .item {
        padding: 1rem;
        margin: 0.5rem 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .item:hover {
        transform: none;
    }

    .item-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }

    .item-actions button {
        flex: 1;
        justify-content: center;
        max-width: 120px;
    }

    form {
        padding: 1.5rem;
        gap: 1rem;
        max-width: 100%;
    }

    .modal-content {
        margin: 2% auto;
        width: 95%;
        padding: 1rem;
        max-height: 95vh;
    }

    input, select {
        padding: 0.6rem;
        font-size: 16px; /* Previne zoom no iOS */
    }
}

/* Celulares pequenos */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.25rem;
    }

    .nav-toggle-container {
        display: flex;
    }

    nav {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transform: translateY(-10px);
        transition: all 0.3s ease;
        padding: 0;
        margin: 0;
    }

    nav.nav-expanded {
        max-height: 500px;
        opacity: 1;
        transform: translateY(0);
        padding: 0 1rem;
        margin: 1rem 0;
    }

    .section {
        padding: 0.75rem;
    }

    .section h2 {
        font-size: 1.1rem;
    }

    button {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        margin: 0.25rem 0.125rem;
    }

    .item {
        padding: 0.75rem;
        margin: 0.5rem 0;
    }

    .item-info {
        font-size: 0.9rem;
    }

    form {
        padding: 1rem;
        gap: 0.75rem;
    }

    label {
        font-size: 0.8rem;
    }

    input, select {
        padding: 0.5rem;
        font-size: 14px;
    }

    .modal-content {
        margin: 1% auto;
        width: 98%;
        padding: 0.75rem;
    }

    .close {
        top: 10px;
        right: 15px;
        font-size: 1.5rem;
        width: 25px;
        height: 25px;
    }
}

/* Celulares muito pequenos */
@media (max-width: 360px) {
    body {
        font-size: 13px;
    }

    .section h2 {
        font-size: 1rem;
    }

    .item-actions {
        flex-direction: column;
        gap: 0.25rem;
        width: 100%;
    }

    .item-actions button {
        width: 100%;
        max-width: none;
    }
}

/* Print styles */
@media print {
    nav, .item-actions button, .modal {
        display: none !important;
    }

    .section {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    button {
        display: none;
    }
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background: #153c35;
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
    width: min(100%, 980px);
    min-height: 560px;
    overflow: hidden;
    background: #fffdf9;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}

.login-brand {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: clamp(2rem, 6vw, 5rem);
    color: #fffdf9;
    background: linear-gradient(145deg, #153c35 0%, #225c4f 58%, #34745f 100%);
}

.login-brand-mark {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin-bottom: auto;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    font-family: Georgia, serif;
    font-size: 2rem;
}

.login-kicker {
    margin-bottom: 0.75rem;
    color: #a9d0bb;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.login-brand h1 {
    margin: 0 0 0.75rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 3.5rem;
    font-weight: 500;
}

.login-brand-caption {
    max-width: 300px;
    color: #d2e3d8;
}

.login-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4.5rem);
}

.login-panel .login-kicker {
    color: #34745f;
}

.login-panel h2 {
    margin-bottom: 2rem;
    color: #213d34;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2rem;
    font-weight: 500;
}

.login-panel form {
    max-width: none;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.login-panel label {
    color: #46564e;
}

.login-panel input {
    width: 100%;
    border-color: #d9e1d9;
    border-radius: 4px;
}

.login-panel input:focus {
    border-color: #34745f;
    box-shadow: 0 0 0 3px rgba(52, 116, 95, 0.14);
}

.login-panel button {
    justify-content: center;
    min-height: 48px;
    margin: 0.5rem 0 0;
    border-radius: 4px;
    background: #225c4f;
}

.login-panel button:hover {
    background: #17483d;
}

.login-panel button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.login-error {
    color: #a53232;
    font-size: 0.9rem;
}

.login-error[hidden] {
    display: none;
}

.logout-button {
    margin-top: 0.75rem;
    background: #714d3e;
}

@media (max-width: 680px) {
    .login-page {
        padding: 1rem;
    }

    .login-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .login-brand {
        min-height: 210px;
        padding: 1.75rem;
    }

    .login-brand-mark {
        width: 44px;
        height: 44px;
        margin-bottom: 1.25rem;
        font-size: 1.5rem;
    }

    .login-brand h1 {
        font-size: 2.5rem;
    }

    .login-panel {
        padding: 2rem 1.75rem;
    }
}