/* ===== ADMIN PAGE STYLES ===== */

/* Admin Hero */
.admin-hero {
    padding: 140px 24px 60px;
    text-align: center;
    background: linear-gradient(180deg, var(--color-bg-secondary) 0%, var(--color-bg) 100%);
    border-bottom: 1px solid var(--color-border);
}

.admin-hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff, var(--color-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-hero-subtitle {
    font-size: 1.1rem;
    color: var(--color-text-muted);
}

/* Admin Section */
.admin-section {
    padding: 40px 0 100px;
}

/* Action Bar */
.admin-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    font-family: var(--font-family);
}

.btn-add {
    background: linear-gradient(135deg, var(--color-accent), #ff6b6b);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(233, 69, 96, 0.5);
}

.btn-export {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.3);
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(37, 211, 102, 0.5);
}

.btn-back {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-back:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    transform: translateY(-2px);
}

/* Admin Stats */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.admin-stat-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-gold);
}

.admin-stat-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Table */
.admin-table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-bg-card);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table thead {
    background: rgba(255, 255, 255, 0.03);
}

.admin-table th {
    padding: 16px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.admin-table td {
    padding: 14px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: var(--transition);
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table Thumbnail */
.table-thumbnail {
    width: 60px;
    height: 45px;
    border-radius: 6px;
    object-fit: cover;
}

/* Table Category Badge */
.table-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.table-badge-villa {
    background: rgba(233, 69, 96, 0.15);
    color: #e94560;
}

.table-badge-appartement {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.table-badge-terrain {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.table-badge-duplex {
    background: rgba(245, 197, 24, 0.15);
    color: #f5c518;
}

/* Table Type */
.table-type {
    font-size: 1.2rem;
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: 8px;
}

.btn-table {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
}

.btn-edit {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.btn-edit:hover {
    background: rgba(99, 102, 241, 0.3);
    transform: scale(1.1);
}

.btn-delete-action {
    background: rgba(233, 69, 96, 0.15);
    color: #e94560;
}

.btn-delete-action:hover {
    background: rgba(233, 69, 96, 0.3);
    transform: scale(1.1);
}

/* Empty State */
.admin-empty {
    text-align: center;
    padding: 80px 24px;
}

.admin-empty .empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.admin-empty h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.admin-empty p {
    color: var(--color-text-muted);
}

/* ===== MODAL ===== */
.admin-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.admin-modal-overlay.active {
    display: flex;
}

.admin-modal {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.admin-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid var(--color-border);
}

.admin-modal-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.admin-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--color-text);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.admin-modal-close:hover {
    background: var(--color-accent);
}

/* Form */
.admin-form {
    padding: 28px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text);
    font-family: var(--font-family);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(160, 160, 176, 0.5);
}

.form-group select option {
    background: var(--color-bg-card);
    color: var(--color-text);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.btn-form {
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: var(--font-family);
}

.btn-save {
    background: linear-gradient(135deg, var(--color-accent), #ff6b6b);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(233, 69, 96, 0.3);
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(233, 69, 96, 0.5);
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-cancel:hover {
    border-color: var(--color-text-muted);
}

.btn-delete {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.3);
}

.btn-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(220, 38, 38, 0.5);
}

/* Confirm Modal */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.confirm-overlay.active {
    display: flex;
}

.confirm-modal {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    animation: modalIn 0.3s ease;
}

.confirm-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.confirm-modal h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.confirm-modal p {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 50px;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    z-index: 4000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    font-size: 1.2rem;
}

/* Nav Admin Link */
.nav-admin {
    color: var(--color-gold) !important;
    font-weight: 600 !important;
}

/* Admin Access Button on medias page */
.btn-admin-access {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 10px 24px;
    border-radius: 50px;
    background: rgba(245, 197, 24, 0.15);
    color: var(--color-gold);
    border: 1px solid rgba(245, 197, 24, 0.3);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--transition);
}

.btn-admin-access:hover {
    background: rgba(245, 197, 24, 0.25);
    border-color: var(--color-gold);
    transform: translateY(-2px);
}

/* ===== FILE UPLOAD ZONE ===== */
.upload-zone {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-sm);
    padding: 24px;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.02);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover {
    border-color: var(--color-accent);
    background: rgba(233, 69, 96, 0.05);
}

.upload-zone.drag-over {
    border-color: var(--color-gold);
    background: rgba(245, 197, 24, 0.08);
    box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.15);
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.upload-icon {
    font-size: 2rem;
}

.upload-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.upload-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.preview-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid var(--color-border);
}

.preview-video {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.btn-remove-file {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    border-radius: 50px;
    background: rgba(233, 69, 96, 0.15);
    color: #e94560;
    border: 1px solid rgba(233, 69, 96, 0.3);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
}

.btn-remove-file:hover {
    background: rgba(233, 69, 96, 0.3);
    border-color: #e94560;
    transform: scale(1.05);
}

/* ===== UPLOAD PROGRESS BAR ===== */
.upload-progress-container {
    width: 100%;
    margin-top: 12px;
    display: none;
}

.upload-progress-container.active {
    display: block;
}

.upload-progress-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.upload-progress-label .progress-text {
    font-weight: 600;
    color: var(--color-text);
}

.upload-progress-label .progress-percent {
    font-weight: 700;
    color: var(--color-gold);
}

.upload-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    overflow: hidden;
    position: relative;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-accent), var(--color-gold));
    border-radius: 50px;
    transition: width 0.3s ease;
    position: relative;
}

.upload-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: progressShine 1.5s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.upload-progress-fill.complete {
    background: linear-gradient(90deg, #25d366, #128c7e);
}

.upload-progress-fill.complete::after {
    animation: none;
}

/* Global upload overlay progress */
.upload-global-progress {
    display: none;
    margin-top: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.upload-global-progress.active {
    display: block;
}

.upload-global-progress .progress-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-global-progress .progress-title .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.upload-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upload-step {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-step .step-icon {
    font-size: 1rem;
    width: 24px;
    text-align: center;
}

.upload-step .step-info {
    flex: 1;
}

.upload-step .step-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 4px;
}

.upload-step .step-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    overflow: hidden;
}

.upload-step .step-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-accent), var(--color-gold));
    border-radius: 50px;
    transition: width 0.2s ease;
}

.upload-step .step-fill.complete {
    background: linear-gradient(90deg, #25d366, #128c7e);
    width: 100% !important;
}

.upload-step .step-percent {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-gold);
    min-width: 40px;
    text-align: right;
}

.upload-step .step-percent.complete {
    color: #25d366;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-actions {
        flex-direction: column;
    }

    .btn-action {
        justify-content: center;
    }

    .admin-table th:nth-child(5),
    .admin-table td:nth-child(5) {
        display: none;
    }

    .admin-modal {
        margin: 12px;
        max-height: 95vh;
    }

    .form-actions {
        flex-direction: column;
    }

    .confirm-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .admin-table th:nth-child(4),
    .admin-table td:nth-child(4),
    .admin-table th:nth-child(6),
    .admin-table td:nth-child(6) {
        display: none;
    }
}