@import url('./cores.css');
@import url('./layout.css');

/* ========== RESET E BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--sidebar-brand-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 600px;
    margin: 20px auto;
    background: var(--sidebar-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid var(--sidebar-brand-bg);
}

h1 {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 2rem;
    font-weight: 700;
}

/* ========== ESTILO DOS STEPS ========== */
.step {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.step:last-child {
    border-bottom: none;
}

.step h3 {
    color: var(--text-light);
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* ========== DATA E HORÁRIO ========== */
.date-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--background);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--background);
    transition: all 0.2s;
    min-height: 44px;
}

.date-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(240, 173, 78, 0.1);
}

/* ========== BOTÕES DE HORÁRIO ========== */
.slots-container {
    display: grid;
    /* Use Grid em vez de Flex para alinhamento perfeito */
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    /* Cria colunas automáticas de min 80px */
    gap: 12px;
    margin-top: 15px;
}

.slot-button {
    padding: 10px 5px;
    /* Ajuste o padding */
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--background);
    color: var(--text-dark);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    width: 100%;
    /* O botão ocupa toda a célula do grid */
    text-align: center;
    /* margin-bottom: 8px; -> Remova, o gap do grid já cuida disso */
}

.slot-button:hover {
    background-color: var(--background);
    border-color: var(--primary);
    color: var(--primary);
}

.slot-button.selected {
    background-color: var(--primary);
    color: var(--text-light);
    border-color: var(--text-light);
    font-weight: 600;
}

/* ========== UNIDADE ========== */
.unit-select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--background);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--background);
    transition: all 0.2s;
    min-height: 44px;
}

.unit-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(240, 173, 78, 0.1);
}

/* ========== SERVIÇOS E CHECKBOX ========== */
.services-container {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.service-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    background-color: #fff;
    border-radius: 8px;
    padding: 12px 15px;
}

.service-item:hover {
    background-color: var(--primary-hover);  /* Cor muito suave */
    border-color: var(--primary);
    color: var(--text-light);
    border-radius: 8px;
    padding: 12px 15px;
    box-shadow: 0 2px 8px rgba(12, 192, 223, 0.1);
}

.service-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s;
}

.service-checkbox.checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.service-checkbox.checked::after {
    content: "✓";
    color: var(--text-light);
    font-weight: bold;
    font-size: 12px;
    border: var(--text-light);
    border-color: var(--text-light);
}

.service-name {
    font-size: 1rem;
    color: var(--text-dark);
    flex: 1;
}

.service-duration {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-left: 10px;
}

.service-descricao {
    color: var(--text-light);
}

/* ========== DURAÇÃO TOTAL ========== */
.duration-summary {
    font-weight: 600;
    color: var(--text-light);
    margin-top: 15px;
    font-size: 1rem;
}

/* ========== FOTO DO ATENDENTE ========== */
.foto-atendente {
    text-align: center;
    margin: 20px 0;
}

.foto-atendente img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.foto-atendente p {
    margin-top: 10px;
    font-weight: bold;
    color: var(--text-dark);
    font-size: 1.1rem;
}

/* ========== ESTILO DOS ATENDENTES ========== */
.atendentes-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
    justify-items: center;
    align-items: start;
}

.atendente-card {
    position: relative;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--background);
    width: 100%;
    min-height: 150px;
    height: 150px;
    max-width: 150px;
}

.atendente-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.atendente-card.selected {
    border-color: var(--success);
    background-color: #f8fff9;
}

.atendente-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.atendente-foto {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    margin-bottom: 10px;
}

.atendente-nome {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.checkmark {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background-color: var(--success);
    color: var(--text-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    display: none;
}

.atendente-card.selected .checkmark {
    display: flex;
}

/* ========== FORMULÁRIO DO CLIENTE ========== */
.client-form {
    margin-top: 20px;
}

.client-form input {
    width: 100%;
    padding: 12px 15px;
    margin: 10px 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--text-light);
    transition: all 0.2s;
}

.client-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(240, 173, 78, 0.1);
}

/* ========== BOTÃO CONFIRMAR ========== */
.btn-confirmar {
    width: 50%;
    padding: 14px;
    background-color: var(--primary-hover);
    color: var(--text-light);
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 20px;
    text-decoration: none;
}

.btn-confirmar:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* ========== RESPONSIVIDADE ========== */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }

    h1 {
        font-size: 1.5rem;
    }

    /* Ajuste dos botões de horário */
    .slot-button {
        min-width: 60px;
        padding: 10px 5px;
        font-size: 0.9rem;
    }

    /* Ajuste da lista de serviços - Centralização no Mobile */
    .service-item {
        flex-direction: column;
        /* Empilha verticalmente */
        align-items: center;
        /* Centraliza horizontalmente */
        text-align: center;
        /* Centraliza o texto */
        gap: 10px;
        padding: 15px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background-color: #fff;
        /* Garante fundo branco */
    }

    .service-checkbox {
        margin-right: 0;
        /* Remove margem lateral pois está empilhado */
        margin-bottom: 5px;
        width: 24px;
        /* Aumenta área de toque */
        height: 24px;
    }

    .service-info {
        margin-left: 0 !important;
        /* Remove margem forçada via inline-style do JS */
        width: 100%;
    }

    .service-name {
        font-size: 1.1rem;
        margin-bottom: 5px;
        display: block;
    }

    .service-meta {
        margin-top: 5px;
    }

    /* Ajuste dos atendentes */
    .atendentes-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .atendente-foto,
    .avatar-letra {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
        margin-bottom: 8px;
    }

    .atendente-nome {
        font-size: 0.9rem;
    }
    .modal-content {
        width: 95%;          /* Aumenta a largura do modal para aproveitar a tela */
        padding: 20px;       /* Ajusta padding interno */
        margin: 20% auto;    /* Centraliza verticalmente */
    }

    .modal-buttons {
        display: flex;
        flex-direction: column-reverse; /* Coloca "Cancelar" embaixo de "Confirmar" (padrão UX mobile) */
        gap: 10px;           /* Espaço entre os botões */
        margin-top: 20px;
    }

    .btn-cancelar, .btn-agendar {
        width: 100%;         /* Botões ocupam toda a largura */
        padding: 12px;       /* Área de toque confortável */
        font-size: 1rem;
        margin-right: 0;     /* Remove margem lateral antiga */
        text-align: center;
    }
}

@media (max-width: 480px) {
    .atendentes-container {
        grid-template-columns: 1fr;
    }
}

/* ========== ESTILO DO FORMULÁRIO DO CLIENTE ========== */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--background);
    transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(240, 173, 78, 0.1);
}

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

/* ========== MODAL DE CONFIRMAÇÃO ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 30px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--text-dark);
}

.modal-buttons {
    margin-top: 20px;
    text-align: right;
}

.btn-cancelar {
    background-color: #6c757d;
    color: var(--text-light);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 10px;
}

.btn-agendar {
    background-color: var(--primary);
    color: var(--text-light);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

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

.btn-cancelar:hover {
    background-color: #5a6268;
}
.loader-spinner {
    display: inline-block;
    width: 48px;
    height: 48px;
    border: 4px solid rgba(140,140,140,0.20);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spinner 1s linear infinite;
    box-sizing: border-box;
    background: transparent;
}
@keyframes spinner {
    to { transform: rotate(360deg);}
}
.loader-center {
    position: fixed;
    left: 0; top: 0; right:0; bottom:0;
    background: rgba(255,255,255,0.7);
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}
.loader-center.show {
    display: flex;
}

.avatar-letra {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary, #0cc0df);
    color: var(--text-light, #fff);
    font-size: 2.3rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px auto;
    border: 2px solid var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .avatar-letra {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
}

.admin-footer {
    color: var(--text-light) !important;
}

/* Garante que avisos (text-warning, text-danger) ocupem a linha inteira no Grid */
.text-warning,
.text-danger {
    grid-column: 1 / -1; /* Faz o elemento ocupar todas as colunas do grid */
    text-align: center;
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--danger);
}

.close {
    display: none !important;
}
