:root {
    /* Paleta de Cores */
    --primary-color: #FF6B35; 
    --primary-hover: #e85d2a;
    --secondary-color: #1e293b;
    --background-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius: 24px;
    
    /* Sombras */
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-bg);
    color: var(--text-main);
    margin: 0;
    padding: 16px; 
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;     
    justify-content: center; 
    overflow-x: hidden;
}

/* Configuração das Telas */
.screen { 
    display: none; 
    width: 100%; 
    justify-content: center; 
}
.screen.active { 
    display: flex; 
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn { 
    from { opacity: 0; transform: scale(0.95); } 
    to { opacity: 1; transform: scale(1); } 
}

/* O CONTAINER */
.container {
    width: 100%;
    max-width: 450px; 
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px; 
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,1);
    margin: 0 auto;
    position: relative;
}

.logo { 
    text-align: center; 
    margin-bottom: 25px; 
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.logo-img {
    max-width: 100%; 
    width: 200px; 
    height: auto;
    object-fit: contain;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
}

.logo p { 
    color: var(--text-muted); 
    font-size: 0.9rem; 
    margin: 0;
    font-weight: 500; 
}

/* Botões */
.button-group { display: flex; flex-direction: column; gap: 12px; width: 100%; }

.btn {
    width: 100%; 
    padding: 16px; 
    border: none; 
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 600; 
    cursor: pointer; 
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    text-decoration: none; 
}

.btn:active { transform: scale(0.96); } 

.btn-primary { 
    background-color: var(--primary-color); 
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.btn-secondary { 
    background-color: white; 
    color: var(--secondary-color);
    border: 2px solid #f1f5f9; 
}

.btn-back {
    background: transparent; border: none; color: var(--text-muted); 
    font-size: 0.9rem; cursor: pointer; margin-bottom: 15px; padding: 0;
    font-weight: 600; display: inline-flex; align-items: center;
}

.btn-icon { 
    background: #f1f5f9; border: none; width: 40px; height: 40px; 
    border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* Header Icons */
.header-icons { display: flex; gap: 8px; }

/* Inputs */
form { display: flex; flex-direction: column; gap: 16px; margin-top: 10px; width: 100%; }

input, textarea, select {
    width: 100%; 
    padding: 16px; 
    background-color: #f8fafc;
    border: 1px solid var(--border-color); 
    border-radius: 14px; 
    font-size: 16px; 
    font-family: inherit;
    color: var(--text-main);
    outline: none;
}

input:focus { 
    background-color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* Filtros Novos */
.filters-row {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}
.filters-row select, .filters-row input {
    font-size: 0.9rem;
    padding: 12px;
}

/* Links e Texto */
h2 { color: var(--secondary-color); font-weight: 700; margin: 0 0 8px 0; font-size: 1.3rem; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.links { display: flex; justify-content: space-between; margin-top: 15px; font-size: 0.85rem; }
.links a { color: var(--text-muted); text-decoration: none; padding: 5px; }

/* Autocomplete */
.autocomplete-container { position: relative; width: 100%; }
.autocomplete-list {
    position: absolute; top: calc(100% + 5px); left: 0; right: 0;
    background: white; border: 1px solid var(--border-color);
    border-radius: 12px; max-height: 200px; overflow-y: auto;
    z-index: 1050; display: none; box-shadow: var(--shadow-lg);
}
.autocomplete-list.show { display: block; }
.autocomplete-item { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem;}

/* Cards e Resultados */
.results-container, .equipment-list { display: grid; gap: 16px; margin-top: 20px; width: 100%; }
.result-card, .equipment-card {
    background: white; border: 1px solid var(--border-color);
    padding: 16px; border-radius: 16px; width: 100%;
    position: relative;
}

/* PREVIEW DA IMAGEM NO UPLOAD (CORRIGIDO PARA QUADRADO) */
#image-preview img {
    width: 100%;
    height: auto;         /* Altura automática */
    aspect-ratio: 1 / 1;  /* Força formato quadrado */
    object-fit: cover;    /* Preenche o quadrado sem distorcer */
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    margin-bottom: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* --- CORAÇÃO DE FAVORITO --- */
.card-image-container { position: relative; width: 100%; }
/* Também ajustado para quadrado na listagem */
.card-image-container img {
    width: 100%; 
    height: auto;
    aspect-ratio: 1 / 1; /* Força quadrado na lista também */
    object-fit: cover; 
    border-radius: 10px; margin-bottom: 12px; background: #e2e8f0; 
}

.btn-favorite {
    position: absolute; top: 10px; right: 10px;
    background: #ffffff; border: 2px solid #cbd5e1;
    width: 42px; height: 42px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2); z-index: 10;
    transition: all 0.2s ease-in-out; color: #64748b; padding-top: 2px; 
}
.btn-favorite:hover { transform: scale(1.1); border-color: #94a3b8; background-color: #f1f5f9; }
.btn-favorite.active {
    border-color: #ef4444; background-color: #fff0f0;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Status e Visual */
.status-badge {
    display: inline-block; padding: 4px 10px;
    border-radius: 6px; font-size: 0.8rem;
    font-weight: 700; margin-bottom: 8px;
    text-transform: uppercase;
}
.status-available { background-color: #dcfce7; color: #166534; }
.status-rented { background-color: #fee2e2; color: #991b1b; }

.card-unavailable img { filter: grayscale(100%); opacity: 0.7; }
.card-unavailable h3, .card-unavailable p { color: #94a3b8; }

.equipment-card { display: flex; flex-direction: column; }
/* Ajuste para imagem na lista do locador também ser quadrada */
.equipment-card img { 
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 10px;
} 

.equipment-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.edit-btn, .delete-btn, .toggle-btn { flex: 1; padding: 10px; border-radius: 10px; border: none; font-weight: 600; cursor: pointer;}
.edit-btn { background: #eff6ff; color: #2563eb; }
.delete-btn { background: #fef2f2; color: #dc2626; }
.toggle-btn { background: #f1f5f9; color: var(--text-main); border: 1px solid #cbd5e1; }
.toggle-btn:hover { background: #e2e8f0; }

/* --- ESTRELAS DE AVALIAÇÃO --- */
.rating-display {
    font-size: 0.9rem;
    color: #f59e0b; /* Amarelo Ouro */
    font-weight: 700;
    margin-top: -5px;
    margin-bottom: 5px;
    cursor: pointer;
    text-decoration: underline;
}
.rating-display:hover { color: #d97706; }

.star-rating-input {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.star {
    font-size: 2.5rem;
    color: #e2e8f0; 
    cursor: pointer;
    transition: color 0.2s;
}

.star.filled { color: #f59e0b; }

.btn-rate {
    background-color: #fff7ed;
    color: #d97706;
    border: 1px solid #ffedd5;
}

/* --- LISTA DE COMENTÁRIOS --- */
.review-item {
    background-color: #f8fafc;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
}
.review-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.review-user { font-weight: 700; font-size: 0.9rem; color: var(--secondary-color); }
.review-stars { color: #f59e0b; font-size: 0.9rem; }
.review-text { font-size: 0.9rem; color: #475569; line-height: 1.4; }
.review-date { font-size: 0.75rem; color: #94a3b8; margin-top: 8px; text-align: right; }

/* Map */
#map { border-radius: 16px; width: 100%; height: 300px; z-index: 1; }

/* Alerts */
#global-alert { 
    position: fixed; top: 20px; left: 20px; right: 20px;
    text-align: center; z-index: 9999; padding: 14px; 
    border-radius: 16px; font-weight: 600; font-size: 0.9rem; 
    box-shadow: var(--shadow-lg); display: none; 
}
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* Loading Spinner */
.spinner { border: 3px solid #e2e8f0; border-top: 3px solid var(--primary-color); border-radius: 50%; width: 30px; height: 30px; animation: spin 1s linear infinite; margin: 20px auto; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* --- MODAL GERAL --- */
.modal-overlay {
    display: none; 
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); 
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 350px;
    padding: 24px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 8px;
}

.modal-phone {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 16px 0;
    letter-spacing: 1px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-whatsapp { background-color: #25D366; color: white; }
.btn-call { background-color: #22c55e; color: white; }
.btn-copy { background-color: #e2e8f0; color: var(--text-main); }

.btn-close-modal {
    position: absolute;
    top: 15px; right: 15px;
    background: none; border: none;
    font-size: 1.5rem; color: #94a3b8;
    cursor: pointer; width: auto; height: auto; padding: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}