/* ==============================================================================
   LASQUINHA SPORTS PISOS - PAINEL ADMINISTRATIVO (ADMIN CSS)
   ============================================================================== */

/* Base & Body */
.admin-body {
    background-color: #07080a;
    color: var(--color-white);
    min-height: 100vh;
    font-family: var(--font-body);
}

/* --------------------------------------------------
   1. TELA DE LOGIN (PROTEÇÃO POR SENHA)
   -------------------------------------------------- */
.admin-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at center, #181a22 0%, #07080a 70%);
}

.admin-login-card {
    background-color: #121318;
    border: 2px solid var(--color-yellow);
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 193, 7, 0.25);
    text-align: center;
    position: relative;
    animation: fadeInCard 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInCard {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo-img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid var(--color-yellow);
    object-fit: cover;
    margin: 0 auto 16px auto;
    box-shadow: 0 0 16px rgba(255, 193, 7, 0.4);
}

.admin-login-card h2 {
    font-size: 1.4rem;
    color: var(--color-white);
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.admin-login-card p {
    font-size: 0.85rem;
    color: var(--color-gray-400);
    margin-bottom: 26px;
}

.password-input-wrap {
    position: relative;
    margin-bottom: 20px;
}

.password-input-wrap input {
    width: 100%;
    padding: 14px 44px 14px 16px;
    background-color: #09090b;
    border: 1px solid var(--border-card);
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.password-input-wrap input:focus {
    border-color: var(--color-yellow);
    box-shadow: 0 0 12px rgba(255, 193, 7, 0.3);
}

.btn-toggle-pass {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--color-gray-400);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    transition: color var(--transition-fast);
}

.btn-toggle-pass:hover {
    color: var(--color-yellow);
}

.login-error-msg {
    color: #ef4444;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: -10px;
    margin-bottom: 16px;
    display: none;
}

.admin-login-card.shake {
    animation: shakeAnim 0.4s ease;
}

@keyframes shakeAnim {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.login-back-link {
    display: inline-block;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--color-gray-400);
    transition: color var(--transition-fast);
}

.login-back-link:hover {
    color: var(--color-yellow);
}

/* --------------------------------------------------
   2. DASHBOARD PRINCIPAL (QUANDO AUTENTICADO)
   -------------------------------------------------- */
.admin-dashboard-wrapper {
    display: none;
    min-height: 100vh;
    padding-bottom: 60px;
}

.admin-navbar {
    background: rgba(14, 15, 20, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-card);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    max-width: 1360px;
    margin: 0 auto;
}

.admin-nav-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-nav-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--color-yellow);
    object-fit: cover;
}

.admin-nav-title {
    font-family: var(--font-subheading);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--color-white);
    letter-spacing: 0.5px;
}

.admin-status-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 8px;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.admin-status-badge.connected {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.admin-status-badge.disconnected {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.admin-status-badge.checking {
    background: rgba(234, 179, 8, 0.15);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.login-db-offline-badge {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    font-size: 0.8rem;
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: -6px;
    margin-bottom: 16px;
    line-height: 1.4;
    text-align: center;
}

/* --------------------------------------------------
   AVISO DE BANCO DE DADOS DESCONECTADO
   -------------------------------------------------- */
.db-alert-banner {
    background: linear-gradient(135deg, rgba(38, 14, 14, 0.95) 0%, rgba(20, 10, 10, 0.95) 100%);
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-left: 5px solid #ef4444;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.12), 0 2px 6px rgba(0, 0, 0, 0.4);
    animation: fadeInBanner 0.35s ease-out;
}

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

.db-alert-content {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.db-alert-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    display: flex;
    align-items: center;
    justify-content: center;
}

.db-alert-text h4 {
    font-family: var(--font-subheading);
    font-size: 0.95rem;
    font-weight: 800;
    color: #fca5a5;
    letter-spacing: 0.5px;
    margin: 0 0 4px 0;
}

.db-alert-text p {
    font-size: 0.84rem;
    color: #e2e8f0;
    line-height: 1.45;
    margin: 0;
}

.db-alert-text p #dbOfflineReason {
    color: #fca5a5;
    font-weight: 600;
}

.db-alert-actions {
    flex-shrink: 0;
}

.btn-retry-db {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fee2e2;
    border-radius: 8px;
    font-family: var(--font-subheading);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-retry-db:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.45);
    border-color: #ef4444;
}

.btn-retry-db svg.spinning {
    animation: spinRotate 0.8s linear infinite;
}

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

@media (max-width: 768px) {
    .db-alert-banner {
        flex-direction: column;
        align-items: stretch;
    }
    .db-alert-actions {
        margin-top: 6px;
    }
    .btn-retry-db {
        width: 100%;
        justify-content: center;
    }
}

.admin-nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-nav-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    font-family: var(--font-subheading);
    font-size: 0.82rem;
    font-weight: 700;
    background: #181a20;
    border: 1px solid var(--border-card);
    color: var(--color-gray-300);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-nav-action:hover {
    border-color: var(--color-yellow);
    color: var(--color-yellow);
}

.btn-nav-logout {
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.btn-nav-logout:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

/* --------------------------------------------------
   3. CARDS DE ESTATÍSTICAS
   -------------------------------------------------- */
.admin-content-container {
    max-width: 1360px;
    margin: 30px auto;
    padding: 0 24px;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 30px;
}

.stat-card {
    background: #121318;
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 20px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color var(--transition-fast);
}

.stat-card:hover {
    border-color: rgba(255, 193, 7, 0.5);
}

.stat-info span {
    font-size: 0.8rem;
    color: var(--color-gray-400);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info h3 {
    font-size: 1.8rem;
    color: var(--color-white);
    margin-top: 4px;
    font-family: var(--font-subheading);
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: rgba(255, 193, 7, 0.1);
    color: var(--color-yellow);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --------------------------------------------------
   4. LAYOUT PRINCIPAL DO DASHBOARD (2 COLUNAS)
   -------------------------------------------------- */
.admin-main-grid {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 26px;
    align-items: start;
}

.admin-card {
    background: #121318;
    border: 1px solid var(--border-card);
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.admin-card-header {
    margin-bottom: 22px;
    border-bottom: 1px solid var(--border-card);
    padding-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-card-header h3 {
    font-size: 1.15rem;
    color: var(--color-white);
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-card-header p {
    font-size: 0.8rem;
    color: var(--color-gray-400);
    margin-top: 2px;
}

/* Formulário de Adição */
.admin-form .form-group {
    margin-bottom: 18px;
}

.admin-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-gray-300);
    margin-bottom: 6px;
}

.admin-form input[type="text"],
.admin-form select {
    width: 100%;
    padding: 12px 14px;
    background-color: #09090b;
    border: 1px solid var(--border-card);
    border-radius: 8px;
    color: var(--color-white);
    font-family: var(--font-body);
    font-size: 0.92rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.admin-form input:focus,
.admin-form select:focus {
    border-color: var(--color-yellow);
}

/* Card Preview */
.admin-preview-container {
    margin-top: 18px;
    background: #09090b;
    border: 1px dashed var(--border-card);
    border-radius: 10px;
    padding: 14px;
}

.admin-preview-container label {
    font-size: 0.78rem;
    color: var(--color-yellow);
    margin-bottom: 10px;
    display: block;
}

.preview-card-box {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    height: 190px;
    background: #14151b;
    border: 1px solid var(--border-card);
}

.preview-card-box img,
.preview-card-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 30%, rgba(9, 9, 11, 0.95) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px;
}

.preview-card-overlay .cat {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--color-yellow);
}

.preview-card-overlay .title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

/* --------------------------------------------------
   5. LISTA DE PROJETOS E FILTROS
   -------------------------------------------------- */
.projects-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.search-input-wrap {
    flex: 1;
    position: relative;
}

.search-input-wrap input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    background: #09090b;
    border: 1px solid var(--border-card);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.88rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.search-input-wrap input:focus {
    border-color: var(--color-yellow);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-gray-400);
}

.filter-select {
    width: 150px;
    padding: 10px 12px;
    background: #09090b;
    border: 1px solid var(--border-card);
    border-radius: 8px;
    color: var(--color-white);
    font-size: 0.88rem;
    outline: none;
}

.projects-table-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 580px;
    overflow-y: auto;
    padding-right: 4px;
}

.project-row-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #09090b;
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 12px 16px;
    transition: all var(--transition-fast);
}

.project-row-item:hover {
    border-color: rgba(255, 193, 7, 0.4);
    background: #0e0f14;
}

.project-row-media {
    width: 80px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #181a20;
    flex-shrink: 0;
}

.project-row-media img,
.project-row-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-row-badge {
    position: absolute;
    bottom: 3px;
    left: 3px;
    font-size: 0.6rem;
    font-weight: 900;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
}

.project-row-badge.video {
    color: var(--color-yellow);
}

.project-row-content {
    flex: 1;
    min-width: 0;
}

.project-row-cat {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--color-yellow);
    display: block;
    margin-bottom: 2px;
}

.project-row-title {
    font-size: 0.98rem;
    color: var(--color-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.project-row-desc {
    font-size: 0.8rem;
    color: var(--color-gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-action-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #181a20;
    border: 1px solid var(--border-card);
    color: var(--color-gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-action-icon:hover {
    border-color: var(--color-yellow);
    color: var(--color-yellow);
    transform: scale(1.05);
}

.btn-action-edit:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.btn-action-delete:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
}

.label-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.label-with-action label {
    margin-bottom: 0 !important;
}

.btn-link-action {
    background: transparent;
    border: none;
    color: var(--color-yellow);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    transition: opacity var(--transition-fast);
}

.btn-link-action:hover {
    opacity: 0.8;
}

.stat-card-clickable {
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.stat-card-clickable:hover {
    border-color: var(--color-yellow);
    transform: translateY(-2px);
}

/* --------------------------------------------------
   6. MODAL ALTERAR SENHA
   -------------------------------------------------- */
.pass-modal-box {
    max-width: 420px;
}

/* --------------------------------------------------
   7. MODAL EDITAR PROJETO
   -------------------------------------------------- */
.edit-modal-box {
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
}

.edit-current-media-wrap {
    width: 100%;
    height: 160px;
    border-radius: 8px;
    overflow: hidden;
    background: #09090b;
    border: 1px solid var(--border-card);
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-current-media-wrap img,
.edit-current-media-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.form-actions-row {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-secondary {
    background: #1f2128;
    color: var(--color-gray-300);
    border: 1px solid var(--border-card);
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: #2a2c35;
    color: #ffffff;
}

/* --------------------------------------------------
   8. MODAL GERENCIAMENTO DE CATEGORIAS
   -------------------------------------------------- */
.categories-modal-box {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.add-cat-box {
    margin-bottom: 24px;
    background: #09090b;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border-card);
}

.add-cat-input-row {
    display: flex;
    gap: 10px;
}

.add-cat-input-row input {
    flex: 1;
    padding: 10px 14px;
    background: #14151b;
    border: 1px solid var(--border-card);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.9rem;
    outline: none;
}

.add-cat-input-row input:focus {
    border-color: var(--color-yellow);
}

.categories-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--color-gray-400);
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.cats-count-badge {
    background: #181a20;
    color: var(--color-yellow);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    border: 1px solid var(--border-card);
}

.categories-items-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0d0e12;
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 12px 16px;
    transition: all var(--transition-fast);
}

.category-item-row:hover {
    border-color: rgba(255, 193, 7, 0.4);
}

.category-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-item-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-white);
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-slug-tag {
    font-size: 0.72rem;
    color: var(--color-gray-400);
    font-family: monospace;
}

.category-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
}

.cat-projects-count {
    color: var(--color-gray-400);
}

.cat-status-pill {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cat-status-pill.active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.cat-status-pill.inactive {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.category-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-toggle-cat {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border-card);
    transition: all var(--transition-fast);
}

.btn-toggle-cat.btn-deactivate {
    background: #181a20;
    color: #f59e0b;
}

.btn-toggle-cat.btn-deactivate:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
}

.btn-toggle-cat.btn-activate {
    background: #181a20;
    color: #22c55e;
}

.btn-toggle-cat.btn-activate:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
}

/* Responsividade */
@media (max-width: 1024px) {
    .admin-main-grid {
        grid-template-columns: 1fr;
    }

    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-nav-container {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .admin-nav-actions {
        width: 100%;
        justify-content: space-between;
    }
}
