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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background-color: #f8fafc;
    overflow-x: hidden; /* Prevenir scroll horizontal */
}

/* Variáveis CSS */
:root {
    --primary-color: #1e40af;
    --primary-light: #3b82f6;
    --success-color: #16a34a;
    --error-color: #dc2626;
    --warning-color: #f59e0b;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* Container principal */
.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 24px;
    padding: 20px 0;
}

.header img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
    box-shadow: var(--shadow-md);
}

.header h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.header p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.card-header {
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.card-title {
    color: var(--gray-800);
    font-size: 1.125rem;
    font-weight: 600;
}

/* Formulários */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-800);
    font-size: 0.875rem;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: white;
    -webkit-appearance: none; /* Remove estilo padrão iOS */
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* Botões */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    -webkit-tap-highlight-color: transparent; /* Remove destaque azul no iOS */
    user-select: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

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

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

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #15803d;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-800);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--gray-300);
    transform: translateY(-1px);
}

.btn-full {
    width: 100%;
}

/* Agenda */
.agenda-container {
    display: grid;
    gap: 8px;
    margin-top: 20px;
}

.agenda-slot {
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
}

.agenda-slot.disponivel {
    background-color: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.agenda-slot.ocupado {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
    cursor: not-allowed;
}

.agenda-slot.bloqueado {
    background-color: #dc2626;
    color: white;
    border-color: #b91c1c;
    cursor: not-allowed;
}

.agenda-slot.disponivel:hover,
.agenda-slot.disponivel:active {
    background-color: #bbf7d0;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.agenda-slot.ocupado:hover,
.agenda-slot.bloqueado:hover {
    opacity: 0.8;
}

/* Dias da semana */
.dias-semana {
    display: grid;
    gap: 12px;
}

.dia-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.dia-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dia-horarios {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dia-horarios input {
    width: 80px;
    padding: 6px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    text-align: center;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s ease;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s ease;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Navigation tabs */
.nav-tabs {
    display: flex;
    background: white;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.nav-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.nav-tab.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-tab:hover:not(.active) {
    background-color: var(--gray-100);
    color: var(--gray-800);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
}

.modal-title {
    color: var(--gray-800);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.modal-subtitle {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Alertas */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Upload de arquivo */
.file-upload {
    border: 2px dashed var(--gray-200);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload:hover {
    border-color: var(--primary-light);
    background-color: #f8fafc;
}

.file-upload input {
    display: none;
}

/* Estilos para dispositivos touch */
.touch-device .touch-active {
    opacity: 0.7;
    transform: scale(0.98);
}

.touch-device .btn:active {
    transform: scale(0.98);
}

.touch-device .agenda-slot:active {
    transform: scale(0.98);
}

/* Responsividade */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .card {
        padding: 16px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .modal {
        margin: 16px;
        padding: 20px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .btn {
        padding: 14px 20px; /* Botões maiores em mobile */
        font-size: 16px; /* Evitar zoom no iOS */
    }
    
    .form-input {
        font-size: 16px; /* Evitar zoom no iOS */
        padding: 14px;
    }
}

/* Melhorias para iOS */
@supports (-webkit-overflow-scrolling: touch) {
    .modal {
        -webkit-overflow-scrolling: touch;
    }
    
    .calendario-container {
        -webkit-overflow-scrolling: touch;
    }
}