@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(255, 255, 255, 0.5);

    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;

    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.1);

    --success-color: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning-color: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);

    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --border-radius: 16px;
    --border-radius-sm: 8px;

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-snappy: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 650px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px;
    flex-grow: 1;
}

/* Typography elements */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.text-center {
    text-align: center;
}

/* Auth Wrapper & Animated Background */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 10;
}

/* Background floating shapes */
.bg-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    animation: float 20s infinite ease-in-out alternate;
    opacity: 0.6;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: rgba(79, 70, 229, 0.4);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: rgba(16, 185, 129, 0.3);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: rgba(245, 158, 11, 0.3);
    bottom: 20%;
    left: 20%;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    33% {
        transform: translate(30px, -50px) rotate(10deg) scale(1.05);
    }

    66% {
        transform: translate(-20px, 20px) rotate(-5deg) scale(0.95);
    }

    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
}

/* Glassmorphism Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-width: 420px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.login-card {
    animation: fadeUpIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeUpIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-circle {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.3);
    position: relative;
}

.logo-circle::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: inherit;
    filter: blur(10px);
    opacity: 0.5;
    z-index: -1;
}

.login-header h2 {
    margin-bottom: 4px;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Error Alert */
.error-alert {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 24px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Form Styles */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.input-icon-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

input[type="text"],
input[type="password"],
input[type="url"],
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: all var(--transition-fast);
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-primary);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.input-icon-wrapper input {
    padding-left: 44px;
}

textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light), inset 0 1px 2px rgba(0, 0, 0, 0.02);
    background: #ffffff;
}

.input-icon-wrapper input:focus+.input-icon,
.input-icon-wrapper input:focus~.input-icon {
    color: var(--primary-color);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

/* Custom File Input Uploads */
.custom-file-input {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.custom-file-label:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    border-color: var(--primary-light) !important;
}

button,
.login-btn {
    width: 100%;
    padding: 14px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 10px rgba(79, 70, 229, 0.3);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

button:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Header & Navigation */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    background: transparent;
    padding: 10px 0 20px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.admin-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.logout-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color var(--transition-fast);
}

.logout-btn:hover {
    color: var(--primary-color);
}

/* Tabs */
.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    padding: 6px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
}

.tab {
    flex: 1;
    text-align: center;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.badge {
    background-color: var(--warning-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.tab.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* Post Items & Feed */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-item {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--card-border);
    transition: transform var(--transition-snappy), box-shadow var(--transition-snappy);
    backdrop-filter: blur(8px);
}

.post-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.status-pending {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.status-completed {
    background: var(--success-bg);
    color: var(--success-color);
}

/* Content Links */
.post-header {
    cursor: pointer;
    user-select: none;
    margin-bottom: 8px;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: background-color var(--transition-fast);
}

.post-header:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.post-link-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    word-break: break-all;
    line-height: 1.4;
}

.post-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.post-link a:hover,
.post-link-title a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.toggle-icon {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Comments Section */
.post-comments-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-item {
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.95rem;
    color: var(--text-primary);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    word-break: break-word;
    position: relative;
    overflow: hidden;
}

.comment-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    transform: translateX(4px);
}

.comment-item:active {
    background: #e5e7eb;
}

.comment-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.evidence-box {
    background: #f8fafc;
    border-left: 4px solid var(--success-color);
    padding: 16px;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    font-size: 0.9rem;
    margin-top: 16px;
    color: var(--text-secondary);
}

/* Admin Actions */
.admin-action-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-action-form button {
    background-color: var(--success-color);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.25);
}

.admin-action-form button:hover {
    background-color: #059669;
    box-shadow: 0 6px 10px rgba(16, 185, 129, 0.3);
}

.user-group {
    margin-bottom: 40px;
}

.user-group-title {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.user-group-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-color);
    margin-left: 16px;
}

/* Utilities */
.hidden {
    display: none !important;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #111827;
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all var(--transition-snappy);
    pointer-events: none;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .card,
    .post-item {
        padding: 16px;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        transition: none !important;
    }

    .modal-content {
        padding: 24px 16px;
        width: 95%;
        max-height: 90vh;
    }

    /* Disable expensive animations on mobile */
    .bg-shape {
        display: none !important;
    }

    body {
        background: #f3f4f6;
        /* Solid color instead of gradient */
    }

    .auth-wrapper {
        padding-top: 20px !important;
    }
}

/* Image Expansion Modal */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity var(--transition-snappy);
}

.image-modal.show-modal {
    display: block;
    opacity: 1;
}

.modal-content-img {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomIn {
    from {
        transform: scale(0.8)
    }

    to {
        transform: scale(1)
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 10000;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

/* ── Copied comment state (green) ─────────────────────────────────────────── */
.comment-item.comment-copied {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--text-primary);
}

.comment-item.comment-copied .comment-icon {
    color: var(--success-color);
}

.copied-badge {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--success-color);
    background: var(--success-bg);
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.03em;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Admin "Nueva Publicación" button ─────────────────────────────────────── */
.btn-action {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 9px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.25);
    width: auto;
}

.btn-action:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 10px rgba(79, 70, 229, 0.3);
}

/* ── Modal (shared) ────────────────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 480px;
    max-height: 85vh; /* Limita altura */
    overflow-y: auto; /* Permite scroll */
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: fadeUpIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal .close-modal {
    position: absolute;
    top: 14px; right: 18px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    background: none;
    border: none;
    width: auto;
    padding: 0;
    box-shadow: none;
}

.modal .close-modal:hover {
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}