@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
    --bg-deep: #080c10;
    --bg-base: #0e141c;
    --bg-elevated: #151d28;
    --bg-card: #1a2433;
    --bg-card-hover: #1f2b3d;
    --border: rgba(148, 163, 184, 0.14);
    --border-strong: rgba(245, 185, 66, 0.35);
    --text: #e8eef6;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --accent: #f5b942;
    --accent-hover: #ffc857;
    --accent-soft: rgba(245, 185, 66, 0.12);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.15);
    --danger: #f87171;
    --danger-hover: #ef4444;
    --info: #38bdf8;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.35);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'DM Sans', system-ui, sans-serif;
    --font-display: 'Space Grotesk', 'DM Sans', sans-serif;
    --max-width: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-base);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(245, 185, 66, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 100% 50%, rgba(56, 189, 248, 0.04), transparent);
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

a { color: var(--info); transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* —— Header público —— */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8, 12, 16, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
}

.site-header__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
}

.site-logo {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-logo span {
    color: var(--accent);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.site-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.site-nav a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* —— Hero —— */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 62px);
    padding: 88px 24px 96px;
    text-align: center;
    overflow: hidden;
    background-image:
        linear-gradient(180deg, rgba(8, 12, 16, 0.82) 0%, rgba(8, 12, 16, 0.7) 45%, rgba(14, 20, 28, 0.94) 100%),
        url('https://coresg-normal.trae.ai/api/ide/v1/text_to_image?prompt=Industrial%20electrical%20control%20panel%20with%20PLC%20programmable%20logic%20controller%2C%20circuit%20breakers%2C%20organized%20colorful%20wiring%2C%20terminal%20blocks%2C%20DIN%20rail%2C%20professional%20industrial%20photography%2C%20cinematic%20lighting%2C%20dark%20blue%20tones%2C%20high%20detail&image_size=landscape_16_9');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-bottom: 1px solid var(--border);
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
    pointer-events: none;
}

.hero__content { position: relative; max-width: 720px; margin: 0 auto; }

.hero__badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--border-strong);
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 20px;
}

.hero h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin: 0 0 16px;
    color: var(--text);
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 0 0 32px;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}

/* —— Secciones —— */
.section {
    padding: 72px 24px;
    text-align: center;
}

.section--alt {
    background: var(--bg-deep);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.section__title {
    font-size: clamp(1.5rem, 3vw, 1.85rem);
    margin: 0 0 12px;
    color: var(--text);
}

.section__subtitle {
    color: var(--text-muted);
    margin: 0 0 40px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.section__inner { max-width: var(--max-width); margin: 0 auto; }

/* —— Grid y tarjetas —— */
.grid {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 28px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    width: min(100%, 280px);
    text-align: left;
    transition: transform 0.25s, border-color 0.25s, background 0.25s;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(245, 185, 66, 0.25);
    background: var(--bg-card-hover);
}

.card h3 {
    font-size: 1rem;
    margin: 0 0 12px;
    color: var(--accent);
}

.card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.card--product .precio {
    margin-top: 16px;
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--text);
}

.card--product .precio strong { color: var(--accent); }

.galeria-producto { margin-bottom: 16px; }

.galeria-producto img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.galeria-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.galeria-nav button {
    background: var(--bg-elevated);
    color: var(--accent);
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    transition: background 0.2s, border-color 0.2s;
}

.galeria-nav button:hover {
    background: var(--accent-soft);
    border-color: var(--border-strong);
}

.galeria-nav span {
    font-size: 0.75rem;
    color: var(--text-dim);
    min-width: 52px;
    text-align: center;
}

/* —— Botones —— */
.btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent) 0%, #d4a017 100%);
    color: #0a0e12 !important;
    padding: 12px 28px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 20px rgba(245, 185, 66, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(245, 185, 66, 0.35);
    color: #0a0e12 !important;
}

.btn--success {
    background: linear-gradient(135deg, var(--success) 0%, #10b981 100%);
    box-shadow: 0 4px 20px rgba(52, 211, 153, 0.2);
    color: #042016 !important;
}

.btn--success:hover { color: #042016 !important; }

.btn--outline {
    background: transparent;
    color: var(--text) !important;
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn--outline:hover {
    border-color: var(--accent);
    color: var(--accent) !important;
}

/* —— Servidor / archivos —— */
.box-archivos {
    margin-top: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 28px;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    border-radius: var(--radius);
    text-align: left;
    box-shadow: var(--shadow-sm);
}

.box-archivos h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: var(--text);
}

.ruta-bar {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.ruta-bar strong, .ruta-bar span { color: var(--accent); }

.zona-privada-divider {
    margin-top: 36px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.form-inline input[type="file"] {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    background: var(--bg-elevated);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.grid-explorador {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 12px;
    text-align: center;
    margin-top: 12px;
}

.explorer-tile {
    padding: 12px 8px;
    border-radius: var(--radius-sm);
    text-align: center;
    box-sizing: border-box;
    transition: border-color 0.2s, background 0.2s;
}

.explorer-tile--back {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    cursor: pointer;
}

.explorer-tile--back:hover { border-color: var(--info); }

.explorer-tile--folder {
    background: var(--accent-soft);
    border: 1px dashed var(--border-strong);
    cursor: pointer;
}

.explorer-tile--folder:hover {
    background: rgba(245, 185, 66, 0.18);
}

.explorer-tile--file {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.explorer-tile__icon { font-size: 1.75rem; user-select: none; }

.explorer-tile__title {
    font-size: 0.68rem;
    font-weight: 600;
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
}

.explorer-tile--back .explorer-tile__title { color: var(--text); }

.explorer-download {
    display: block;
    margin-top: 8px;
    color: var(--success) !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.65rem;
    background: var(--success-soft);
    padding: 4px 6px;
    border-radius: 4px;
}

.explorer-empty {
    grid-column: 1 / -1;
    color: var(--text-dim);
    font-size: 0.875rem;
    text-align: center;
    padding: 16px;
}

/* —— Footer —— */
.site-footer {
    background: var(--bg-deep);
    border-top: 1px solid var(--border);
    padding: 32px 24px;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.site-footer strong { color: var(--accent); }

/* —— Admin —— */
body.page-admin {
    padding: 24px;
}

.admin-wrap { max-width: 820px; margin: 0 auto; }

.admin-top-link {
    text-align: right;
    margin-bottom: 20px;
}

.admin-top-link a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.admin-top-link a:hover { color: var(--accent); }

.admin-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.admin-header h1 {
    margin: 0 0 6px;
    font-size: 1.5rem;
}

.admin-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.panel-card h2, .panel-card h3 {
    margin-top: 0;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 20px;
    font-size: 1.15rem;
}

.panel-card label {
    display: block;
    margin-top: 14px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

.panel-card label strong { color: var(--text); }

.panel-card input[type="text"],
.panel-card input[type="number"],
.panel-card input[type="email"],
.panel-card input[type="password"],
.panel-card input[type="file"],
.panel-card select,
.panel-card textarea {
    width: 100%;
    padding: 12px 14px;
    margin-top: 8px;
    box-sizing: border-box;
    font-size: 0.95rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s;
}

.panel-card input:focus,
.panel-card select:focus,
.panel-card textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.panel-card button[type="submit"],
.panel-card > form > button {
    margin-top: 20px;
    padding: 14px;
    width: 100%;
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: #042016;
    border: none;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    border-radius: var(--radius-sm);
    transition: transform 0.2s, opacity 0.2s;
}

.panel-card button[type="submit"]:hover { transform: translateY(-1px); opacity: 0.95; }

.btn-primary-blue {
    background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%) !important;
    color: #042f4a !important;
}

.btn-danger {
    background: var(--danger) !important;
    color: #fff !important;
    border: none;
    padding: 8px 14px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    width: auto !important;
    margin: 0 !important;
    font-size: 0.8rem;
}

.btn-danger:hover { background: var(--danger-hover) !important; }

.hint { font-size: 0.8rem; color: var(--text-dim); margin-top: 6px; }

.preview-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.preview-imgs img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    margin-top: 16px;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    border: 1px solid var(--border);
    padding: 12px 14px;
    text-align: left;
}

.data-table th {
    background: var(--bg-elevated);
    color: var(--accent);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.data-table tr:nth-child(even) td { background: rgba(0, 0, 0, 0.15); }

.data-table td { color: var(--text-muted); }

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.item-folder, .item-file {
    text-align: center;
    padding: 14px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

.item-folder {
    background: var(--accent-soft);
    border: 1px dashed var(--border-strong);
    cursor: pointer;
}

.item-folder:hover { background: rgba(245, 185, 66, 0.18); }

.item-folder .icon, .item-file .icon {
    font-size: 2.25rem;
    cursor: pointer;
    user-select: none;
}

.item-title {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
}

.item-title a { color: var(--info); text-decoration: none; font-size: inherit; }

.explorer-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }

.text-muted { color: var(--text-muted); font-size: 0.875rem; }

/* —— Auth (login / registro) —— */
body.page-auth {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-box {
    width: min(100%, 380px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 40px 36px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.auth-box h2 {
    margin: 0 0 8px;
    font-size: 1.35rem;
}

.auth-box .auth-sub {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0 0 28px;
}

.auth-box input {
    width: 100%;
    padding: 14px 16px;
    margin: 0 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font);
}

.auth-box input:focus {
    outline: none;
    border-color: var(--accent);
}

.auth-box input::placeholder { color: var(--text-dim); }

.auth-box .btn { width: 100%; margin-top: 8px; }

.auth-footer {
    margin-top: 24px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-footer a { font-weight: 500; }

.auth-brand {
    display: block;
    margin-bottom: 24px;
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
}

@media (max-width: 640px) {
    .site-header__inner { justify-content: center; text-align: center; }
    .site-nav { justify-content: center; }
    .hero { padding: 64px 20px 72px; }
    .section { padding: 48px 20px; }
}
