/* ============================================================
   ESIBot — style.css
   Autor: Rod (mejorado)
   Tema: Dark Tech / Maker Aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,700;1,9..40,300&display=swap');

/* ── Variables ── */
:root {
    --red:        #ef4444;
    --blue:       #3b82f6;
    --blue-dark:  #2563eb;
    --green:      #10b981;
    --yellow:     #f59e0b;

    --bg:         #0d1117;   /* fondo principal */
    --bg-card:    #161b22;   /* tarjetas */
    --bg-raised:  #1c2333;   /* elementos elevados */
    --border:     #30363d;   /* bordes sutiles */

    --text:       #e6edf3;   /* texto principal */
    --text-muted: #7d8590;   /* texto secundario */
    --text-dim:   #484f58;   /* texto muy apagado */

    --radius:     10px;
    --radius-lg:  16px;
    --shadow:     0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg:  0 8px 40px rgba(0,0,0,0.6);

    --font-head:  'Syne', sans-serif;
    --font-body:  'DM Sans', sans-serif;

    --transition: 0.2s ease;

    /* Tema-aware: dark por defecto */
    --header-bg:   rgba(13,17,23,0.95);
    --grid-line:   rgba(48,54,61,0.3);
}

/* ── Dim Mode (oscuro suave, intermedio) ── */
html.dim-mode {
    --bg:         #1a2032;
    --bg-card:    #232a40;
    --bg-raised:  #2c3450;
    --border:     #3b4565;
    --text:       #e6edf3;
    --text-muted: #9aa3b8;
    --text-dim:   #5e6786;

    --header-bg:  rgba(26,32,50,0.92);
    --grid-line:  rgba(59,69,101,0.35);

    --shadow:     0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg:  0 8px 40px rgba(0,0,0,0.45);
}

/* ── Light Mode ── */
html.light-mode {
    --bg:         #f6f8fa;
    --bg-card:    #ffffff;
    --bg-raised:  #eef1f5;
    --border:     #d0d7de;
    --text:       #1f2328;
    --text-muted: #57606a;
    --text-dim:   #8c959f;

    --header-bg:  rgba(255,255,255,0.92);
    --grid-line:  rgba(208,215,222,0.45);

    --shadow:     0 4px 24px rgba(15,23,42,0.08);
    --shadow-lg:  0 8px 40px rgba(15,23,42,0.12);
}

/* ── Theme Toggle Button ── */
.theme-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1200;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.theme-toggle-btn:hover {
    transform: scale(1.12);
    box-shadow: var(--shadow-lg);
}

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    /* Sutil patrón de cuadrícula para dar textura técnica */
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 40px 40px;
    background-attachment: fixed;
}

/* ── Animación de entrada ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.5s ease forwards; }
.fade-up-1 { animation-delay: 0.05s; opacity: 0; }
.fade-up-2 { animation-delay: 0.15s; opacity: 0; }
.fade-up-3 { animation-delay: 0.25s; opacity: 0; }
.fade-up-4 { animation-delay: 0.35s; opacity: 0; }

/* ================================================================
   HEADER
   ================================================================ */
header {
    text-align: center;
    padding: 22px 20px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow);
}

header h1 {
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

header h1 a { text-decoration: none; }
header h1 span:nth-child(1) { color: var(--red); }
header h1 span:nth-child(2) { color: var(--blue); }

header p {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* ================================================================
   HAMBURGUESA
   ================================================================ */
.hamburger {
    display: block;
    position: fixed;
    top: 18px;
    right: 20px;
    z-index: 1100;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 8px 10px;
    transition: background var(--transition);
}
.hamburger:hover { background: var(--border); }

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    margin-bottom: 5px;
    background-color: var(--text);
    border-radius: 2px;
    transition: transform 0.3s ease;
}
.hamburger span:last-child { margin-bottom: 0; }

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: -270px;
    width: 260px;
    height: 100%;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    padding: 70px 0 30px;
    box-shadow: var(--shadow-lg);
}

.sidebar h3 {
    font-family: var(--font-head);
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--text-dim);
    text-transform: uppercase;
    padding: 0 20px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.sidebar ul { list-style: none; }

.sidebar ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.sidebar ul li a:hover {
    color: var(--text);
    background: var(--bg-raised);
    border-left-color: var(--blue);
}

.sidebar .sidebar-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 12px 20px;
}

.sidebar .link-login  { color: var(--blue) !important; }
.sidebar .link-signup { color: var(--green) !important; }

/* ================================================================
   MAIN
   ================================================================ */
main {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

/* ================================================================
   HERO (Index)
   ================================================================ */
.hero {
    text-align: center;
    padding: 70px 20px 50px;
    position: relative;
}

.hero-badge {
    display: inline-block;
    background: rgba(59,130,246,0.12);
    border: 1px solid rgba(59,130,246,0.3);
    color: var(--blue);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 999px;
    margin-bottom: 22px;
}

.hero h2 {
    font-family: var(--font-head);
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1px;
    color: var(--text);
    margin-bottom: 18px;
}

.hero h2 .accent-red  { color: var(--red); }
.hero h2 .accent-blue { color: var(--blue); }

.hero p {
    max-width: 520px;
    margin: 0 auto 32px;
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--blue);
    color: white;
    text-decoration: none;
    padding: 13px 28px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all var(--transition);
    box-shadow: 0 4px 20px rgba(59,130,246,0.35);
}
.hero-cta:hover {
    background: var(--blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(59,130,246,0.5);
}

/* ================================================================
   DEPARTAMENTOS (Index)
   ================================================================ */
.section-label {
    font-family: var(--font-head);
    font-size: 0.72rem;
    letter-spacing: 2.5px;
    color: var(--text-dim);
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 24px;
}

#areas-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 640px;
    margin: 0 auto 60px;
}

.area-square {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
    padding: 36px 20px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.area-square::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity var(--transition);
    border-radius: inherit;
}

.area-square:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.area-square:hover::before { opacity: 1; }

.area-square h3 {
    font-family: var(--font-head);
    font-size: 1rem;
    position: relative;
    z-index: 1;
}

.area-square .dept-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

/* Colores por departamento */
#areas-container .area-square:nth-child(1) {
    border-top: 3px solid var(--red);
}
#areas-container .area-square:nth-child(1)::before {
    background: linear-gradient(135deg, rgba(239,68,68,0.08), transparent);
}

#areas-container .area-square:nth-child(2) {
    border-top: 3px solid var(--blue);
}
#areas-container .area-square:nth-child(2)::before {
    background: linear-gradient(135deg, rgba(59,130,246,0.08), transparent);
}

#areas-container .area-square:nth-child(3) {
    border-top: 3px solid var(--green);
}
#areas-container .area-square:nth-child(3)::before {
    background: linear-gradient(135deg, rgba(16,185,129,0.08), transparent);
}

#areas-container .area-square:nth-child(4) {
    border-top: 3px solid var(--yellow);
}
#areas-container .area-square:nth-child(4)::before {
    background: linear-gradient(135deg, rgba(245,158,11,0.08), transparent);
}

/* ================================================================
   FORO
   ================================================================ */
.seccion-foro {
    max-width: 800px;
    margin: 0 auto 40px;
}

.seccion-foro h2 {
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 18px;
}

.vertical-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.area-rectangle {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    padding: 16px 20px;
    text-decoration: none;
    color: var(--text);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.area-rectangle:hover {
    transform: translateX(4px);
    background: var(--bg-raised);
    border-color: var(--border);
}

.area-rectangle h3 {
    font-family: var(--font-head);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.area-rectangle p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* Tabla de posts */
.tabla-posts {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tabla-posts th {
    text-align: left;
    padding: 10px 14px;
    background: var(--bg-raised);
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    font-family: var(--font-head);
    border-bottom: 1px solid var(--border);
}

.tabla-posts td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.tabla-posts tr:hover td { background: var(--bg-raised); }

/* Crear Post */
.crear-post-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 40px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.crear-post-container h3 {
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-field {
    margin-bottom: 16px;
}

.form-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.92rem;
    transition: border-color var(--transition);
    outline: none;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.form-field textarea { min-height: 100px; resize: vertical; }

.btn-publish {
    background: var(--blue);
    color: white;
    border: none;
    padding: 11px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
}
.btn-publish:hover {
    background: var(--blue-dark);
    transform: translateY(-1px);
}

/* Admin delete buttons */
.btn-delete-post, .btn-delete-reply {
    background: none;
    border: 1px solid var(--red, #ef4444);
    color: var(--red, #ef4444);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
    line-height: 1.6;
}
.btn-delete-post:hover, .btn-delete-reply:hover {
    opacity: 1;
    background: rgba(239,68,68,0.1);
}
.btn-delete-admin {
    background: none;
    border: 1px solid var(--red, #ef4444);
    color: var(--red, #ef4444);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
    margin-left: auto;
}
.btn-delete-admin:hover {
    opacity: 1;
    background: rgba(239,68,68,0.1);
}

/* ================================================================
   DASHBOARD
   ================================================================ */
.dashboard-header {
    text-align: center;
    padding: 40px 20px 30px;
}

.dashboard-header h2 {
    font-family: var(--font-head);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 6px;
}

.dashboard-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.projects-container {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    padding: 0 0 60px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.project-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--blue);
    transform: scaleX(0);
    transition: transform var(--transition);
    transform-origin: left;
}

.project-card:hover {
    border-color: rgba(59,130,246,0.4);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.project-card:hover::after { transform: scaleX(1); }

.project-card.expanded {
    border-color: rgba(59,130,246,0.5);
    background: var(--bg-raised);
    box-shadow: var(--shadow);
}

.project-card .card-detail {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease, margin-top 0.25s ease;
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin-top: 0;
    border-top: 0px solid var(--border);
}

.project-card.expanded .card-detail {
    max-height: 300px;
    opacity: 1;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.project-card h3 {
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.project-card p {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.tag-progress { background: rgba(245,158,11,0.15); color: var(--yellow); border: 1px solid rgba(245,158,11,0.3); }
.tag-done     { background: rgba(16,185,129,0.15);  color: var(--green);  border: 1px solid rgba(16,185,129,0.3); }
.tag-stop     { background: rgba(239,68,68,0.15);   color: var(--red);    border: 1px solid rgba(239,68,68,0.3); }

/* ================================================================
   AUTH (Login, Signup)
   ================================================================ */
.auth-body {
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 40px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.4s ease;
}

.logo-auth {
    font-family: var(--font-head);
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 6px;
}
.logo-auth span:nth-child(1) { color: var(--red); }
.logo-auth span:nth-child(2) { color: var(--blue); }

.auth-card h2 {
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.input-group {
    text-align: left;
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.input-group input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition);
}

.input-group input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.btn-main {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 8px;
    background: var(--blue);
    color: white;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 8px;
    transition: all var(--transition);
    text-decoration: none;
    display: inline-block;
    box-sizing: border-box;
    letter-spacing: 0.3px;
}
.btn-main:hover {
    background: var(--blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59,130,246,0.35);
}

.switch-auth {
    margin-top: 22px;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.switch-auth a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 600;
}
.switch-auth a:hover { text-decoration: underline; }

/* ================================================================
   ABOUT
   ================================================================ */
.simple-nav {
    padding: 18px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 900;
}

.simple-nav a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition);
}
.simple-nav a:hover { color: var(--text); }
.simple-nav .logo-auth { margin-bottom: 0; }

.btn-small {
    background: var(--blue);
    color: white !important;
    padding: 7px 16px;
    border-radius: 6px;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    transition: background var(--transition);
}
.btn-small:hover { background: var(--blue-dark); }

/* About page layout */
.about-page { align-items: flex-start; }

.about-hero {
    text-align: center;
    padding: 60px 20px 40px;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}

.about-hero h1 {
    font-family: var(--font-head);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text);
    margin-bottom: 16px;
}

.about-hero h1 span { color: var(--red); }

.about-hero p {
    max-width: 560px;
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.75;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin: 0 auto 40px;
    width: 100%;
    max-width: 960px;
    padding: 0 20px;
}

.card {
    background: var(--bg-card);
    padding: 28px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    border-bottom: 3px solid var(--blue);
    color: var(--text);
    transition: all var(--transition);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-bottom-color: var(--red);
}
.card h3 {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}
.card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

.cta-section {
    text-align: center;
    padding: 20px 20px 60px;
}
.cta-section p { color: var(--text-muted); margin-bottom: 14px; }

/* ================================================================
   FOOTER
   ================================================================ */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.82rem;
}

.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}
.site-footer a:hover { color: var(--blue); }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 600px) {
    #areas-container {
        grid-template-columns: 1fr;
    }
    .projects-container {
        grid-template-columns: 1fr;
    }
    .auth-card {
        padding: 30px 24px;
    }
    .hero h2 { font-size: 1.8rem; }
}
