/* ============= LAYOUT PRINCIPAL ============= */
main.page-content {
    padding-top: 100px;
    margin: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.6)), var(--bg-hero);
    min-height: 100vh;
}

[data-theme="dark"] main.page-content {
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), var(--bg-hero);
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ============= CABEÇALHO ADMIN ============= */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    border-bottom: 2px solid var(--text-tertiary);
    padding-bottom: 20px;
}

.admin-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 700;
}

.admin-header button {
    padding: 10px 20px;
    font-size: 1rem;
}

/* ============= SEÇÕES DE FORMULÁRIO ============= */
.form-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px var(--shadow-light);
    border: 1px solid var(--border-color);
}

.form-section h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 25px;
    font-weight: 600;
}

/* ============= CABEÇALHO DE IMÓVEIS ============= */
.imoveis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.imoveis-header h2 {
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.imoveis-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============= GRID DE FORMULÁRIO ============= */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* ============= GRUPOS DE FORMULÁRIO ============= */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--text-tertiary);
    box-shadow: 0 0 0 3px rgba(34, 59, 197, 0.1);
    background: var(--bg-secondary);
}

.form-group input:read-only {
    background-color: var(--bg-secondary);
    cursor: not-allowed;
    opacity: 0.8;
}

.form-group input:disabled {
    background-color: var(--bg-secondary);
    cursor: not-allowed;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    grid-column: 1 / -1;
}

/* ============= AÇÕES DO FORMULÁRIO ============= */
.form-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 25px;
    grid-column: 1 / -1;
}

.btn-submit,
.btn-reset {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-submit {
    background: var(--gradient-primary);
    color: white;
    grid-column: 1 / -1;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 59, 197, 0.3);
}

/* ============= BOTÃO ATUALIZAR ============= */
.btn-update {
    background: linear-gradient(135deg, #FF9500, #FF7B54);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    grid-column: 1 / -1;
}

.btn-update:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 149, 0, 0.3);
}

.btn-reset {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-reset:hover {
    background: var(--bg-primary);
    border-color: var(--text-tertiary);
}

/* ============= BOTÃO CANCELAR EDIÇÃO ============= */
.btn-cancel {
    background: rgba(255, 100, 100, 0.1);
    color: rgb(255, 100, 100);
    border: 1px solid rgb(255, 100, 100);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    grid-column: 1 / -1;
}

.btn-cancel:hover {
    background: rgb(255, 100, 100);
}

/* ============= ESTADO DE EDICAO ============= */
.form-section.is-editing .btn-update,
.form-section.is-editing .btn-cancel {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-width: 2px;
}

.form-section.is-editing .btn-update {
    letter-spacing: 0.3px;
}

.form-section.is-editing .btn-cancel {
    background: rgba(255, 100, 100, 0.15);
}

/* ============= LISTA DE IMÓVEIS ============= */
.imoveis-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.imoveis-list > p {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-size: 1rem;
}

.imovel-row {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
}

.imovel-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow-light);
}

.imovel-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.imovel-id {
    color: var(--text-primary);
    font-weight: 600;
}

.imovel-address {
    color: var(--text-secondary);
}

.imovel-destaque {
    margin-top: 6px;
}

.badge-destaque {
    display: inline-block;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 167, 38, 0.3);
}

.imovel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-delete,
.btn-edit {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-edit {
    background: var(--gradient-primary);
    color: white;
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 59, 197, 0.3);
}

.btn-delete {
    background: rgba(255, 76, 76, 0.1);
    color: rgb(255, 76, 76);
    border: 1px solid rgb(255, 76, 76);
}

.btn-delete:hover {
    background: rgb(255, 76, 76);
    color: white;
}
/* ============= BOTÕES DE CONTROLE DE IMÓVEIS ============= */
.btn-control,
.btn-delete-selected {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 50px;
    height: 50px;
}

.btn-control {
    background: var(--gradient-primary);
    color: white;
}

.btn-control:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 59, 197, 0.3);
}

.btn-control:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-delete-selected {
    background: rgba(255, 76, 76, 0.1);
    color: rgb(255, 76, 76);
    border: 1px solid rgb(255, 76, 76);
}

.btn-delete-selected:hover:not(:disabled) {
    background: rgb(255, 76, 76);
    color: white;
}

.btn-delete-selected:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============= CHECKBOX E SELEÇÃO ============= */
.imovel-row.selected {
    background: rgba(34, 59, 197, 0.05);
    border: 2px solid var(--text-tertiary);
    box-shadow: 0 4px 15px rgba(34, 59, 197, 0.2);
}

.imovel-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--text-tertiary);
}

.imovel-row input[type="checkbox"] {
    cursor: pointer;
}
/* ============= AUTENTICAÇÃO ============= */
#auth-form {
    max-width: 450px;
    margin: 60px auto;
}

#auth-form .form-section {
    box-shadow: 0 10px 40px var(--shadow-light);
}

#auth-form h2 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 30px;
}

#auth-form .form-group {
    margin-bottom: 20px;
}

#auth-form .btn-submit {
    margin-top: 15px;
}

/* ============= MENSAGENS ============= */
#message-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(500px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.message {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 12px var(--shadow-light);
    font-weight: 500;
    animation: slideOut 0.3s ease;
}

@keyframes slideOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.loading {
    background: #cfe2ff;
    color: #084298;
    border: 1px solid #b6d4fe;
}

.message button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message button:hover {
    opacity: 0.7;
}

/* ============= MODAL DE CONFIRMACAO ============= */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    z-index: 1;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 24px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    width: min(92vw, 420px);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-content h3 {
    margin: 0;
    font-size: 1.2rem;
}

.modal-countdown {
    font-weight: 600;
    color: var(--text-tertiary);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============= NAVEGAÇÃO ============= */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.navbar {
    display: flex;
    align-items: center;
    padding: 0 40px;
    height: 80px;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-brand img {
    height: 50px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-tertiary);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
    color: var(--text-tertiary);
}

/* ============= RESPOSTA VISUAL PARA CAMPOS VAZIOS ============= */
.imoveis-list:empty::before {
    content: '📭 Nenhum imóvel cadastrado';
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    padding: 60px 20px;
    font-size: 1.1rem;
    font-weight: 500;
}

/* ============= SCROLLBAR CUSTOMIZADA ============= */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(34, 59, 197, 0.8);
}

/* ============= ANIMAÇÕES ============= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-section,
.imovel-row {
    animation: fadeIn 0.3s ease;
}

/* ============= RESPONSIVO ============= */
@media (max-width: 768px) {
    main.page-content {
        padding-top: 130px;
    }

    .admin-container {
        padding: 20px 15px;
    }

    .admin-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
        border-bottom: 1px solid var(--border-color);
    }

    .admin-header h1 {
        font-size: 1.5rem;
    }

    .admin-header button {
        width: 100%;
    }

    .form-section {
        padding: 20px;
        margin-bottom: 20px;
    }

    .imoveis-header {
        flex-direction: column;
        align-items: stretch;
    }

    .imoveis-header h2 {
        margin-bottom: 15px;
    }

    .imoveis-controls {
        justify-content: stretch;
    }

    .imoveis-controls button {
        flex: 1;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .form-actions {
        grid-template-columns: 1fr;
    }

    .btn-submit {
        grid-column: 1;
    }

    .imoveis-list {
        gap: 10px;
    }

    #message-container {
        left: 20px;
        right: 20px;
        max-width: none;
    }

    .imovel-actions {
        flex-direction: column;
    }

    .btn-delete,
    .btn-edit {
        width: 100%;
    }

    .navbar {
        padding: 0 20px;
        height: 70px;
    }

    .nav-links {
        display: none;
    }
}

@media (max-width: 480px) {
    main.page-content {
        padding-top: 120px;
    }

    .admin-header h1 {
        font-size: 1.2rem;
    }

    .form-section h2 {
        font-size: 1.2rem;
    }

    .form-section {
        padding: 15px;
    }

    .button {
        font-size: 0.9rem;
        padding: 10px 16px;
    }

    .navbar {
        padding: 0 15px;
    }
}
