/* ==========================================================================
   DOCENTECH WORKSPACE - PREMIUM DARK SYSTEM DESIGN
   ========================================================================== */

/* Variables & Design Tokens */
:root {
    --bg-base: #070a13;
    --bg-surface: #0f172a;
    --bg-card: rgba(15, 23, 42, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --bg-console: #030712;

    /* Primary brand neon gradients */
    --primary: #6366f1;
    --primary-light: #8b5cf6;
    --primary-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --primary-glow: rgba(99, 102, 241, 0.35);

    /* State colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info: #38bdf8;

    /* Text & Typography */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-console: #38bdf8;

    /* Borders & Accents */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-focus: rgba(99, 102, 241, 0.5);
    --border-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));

    /* Shadows & Glassmorphism effects */
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    --glass-blur: blur(16px);
}

/* Reset & Core Standards */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-base);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.4) 0%, var(--bg-base) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    padding: 3rem 1.5rem;
    min-height: 100vh;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
}

/* Header Dashboard Styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1.5rem;
}

.header-left h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.2;
}

.header-left h1 span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    position: relative;
}

.header-left h1 span::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

.header-left p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    font-weight: 350;
    margin-top: 0.5rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Connection Badges */
.status-badge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
}

.status-indicator.pulses {
    animation: glow-pulse 2s infinite alternate;
}

/* Layout Grid System */
.grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 860px) {
    .grid-container {
        grid-template-columns: 1fr;
    }

    body {
        padding: 1.5rem 1rem;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }
}

/* Glassmorphism Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-soft);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s, box-shadow 0.3s;
    overflow: visible;
    /* Changed to visible to prevent tooltip clipping */
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-soft), var(--shadow-glow);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.card-icon {
    font-size: 1.5rem;
}

.card-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Form Controls & Labels */
.input-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.label-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.input-group label {
    font-weight: 500;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.input-group input[type="email"],
.input-group input[type="text"],
.input-group input[type="date"],
.input-group input[type="url"],
.input-group input[type="password"],
.input-group textarea {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s, background-color 0.3s;
    color: var(--text-primary);
    font-size: 0.95rem;
    width: 100%;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.input-group textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.45;
}

.input-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.consigna-hint {
    margin-top: 0.4rem;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 2.75rem !important;
}

.btn-toggle-visibility {
    position: absolute;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
    transition: color 0.3s;
}

.btn-toggle-visibility:hover {
    color: var(--text-primary);
}

.input-help-text {
    margin-top: 0.4rem;
    font-size: 0.8rem;
}

.input-help-text a {
    color: var(--info);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.input-help-text a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Tooltips */
.tooltip-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: help;
    transition: background 0.3s, color 0.3s;
    user-select: none;
    font-weight: 700;
}

.tooltip-trigger:hover {
    background: var(--primary);
    color: white;
}

/* Tooltip standard positioning via Javascript fallback or custom attribute (CSS standard) */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: #111827;
    /* Opaque solid dark background */
    border: 1px solid var(--primary);
    /* Indigo border to stand out */
    color: var(--text-primary);
    padding: 0.85rem 1.15rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 400;
    width: 280px;
    text-align: left;
    /* Align text left for easier reading of descriptions */
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7), 0 0 15px rgba(99, 102, 241, 0.2);
    /* Deep shadow with indigo glow */
    z-index: 99999;
    /* Float over absolutely everything */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
    line-height: 1.5;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: var(--primary) transparent transparent transparent;
    /* Matches indigo border */
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-tooltip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* Custom Styled Toggle Switches */
.toggle-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1rem;
}

.toggle-group {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 25px;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: background-color 0.3s;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider:before {
    position: absolute;
    content: "";
    height: 17px;
    width: 17px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-primary);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

input:checked+.slider {
    background: var(--primary-gradient);
}

input:checked+.slider:before {
    transform: translateX(21px);
    background-color: #ffffff;
}

.toggle-info {
    display: flex;
    flex-direction: column;
}

.toggle-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
    line-height: 1.3;
}

/* Dashboard Metrics & Telemetry */
.metrics-section {
    margin-bottom: 2.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 20px;
}

.section-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.section-icon {
    font-size: 1.5rem;
}

.section-title-wrapper h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
}

.badge-privacy {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: transform 0.3s;
}

.metric-card:hover {
    transform: translateY(-3px);
}

.metric-icon {
    font-size: 1.8rem;
    opacity: 0.85;
}

.metric-data {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* History Logs & Activity Table */
.history-card {
    background: var(--bg-card);
    padding: 1.5rem !important;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.history-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
}

.history-list-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.history-table th {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.history-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.badge-mode,
.badge-status {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-mode.simulado {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.badge-mode.produccion {
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #c084fc;
}

.badge-status.exito {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.badge-status.fallo {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.link-doc {
    color: var(--info);
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
}

.link-doc:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Action Buttons Design */
.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.3s, border-color 0.3s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-tertiary {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: color 0.3s;
    padding: 0.25rem 0.5rem;
}

.btn-tertiary:hover {
    color: var(--error);
    text-decoration: underline;
}

.btn-simulation {
    background: transparent;
    border: 1px dashed var(--primary);
    color: #a5b4fc;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.9rem;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s, color 0.3s;
}

.btn-simulation:hover {
    background: rgba(99, 102, 241, 0.08);
    color: white;
}

.form-actions {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

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

/* Real-Time Terminal & Execution Logs */
.console-card {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    scroll-margin-top: 1rem;
    background-color: var(--bg-console) !important;
    border: 1px solid rgba(56, 189, 248, 0.2) !important;
    border-radius: 12px;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(56, 189, 248, 0.15) !important;
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
}

.console-header h2 {
    color: #ffffff !important;
    font-size: 1.15rem;
    font-weight: 600;
}

.console-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(56, 189, 248, 0.2);
    border-top-color: var(--info);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.btn-close-console {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    transition: color 0.3s;
}

.btn-close-console:hover {
    color: var(--text-primary);
}

.progress-wrapper {
    margin-bottom: 1.5rem;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.progress-container {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
    height: 6px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--success), #34d399);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.logs {
    max-height: 250px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: var(--text-console);
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.log-line {
    margin-bottom: 0.35rem;
    word-break: break-all;
    line-height: 1.4;
}

.log-line.system {
    color: #facc15;
}

.log-line.error {
    color: #f87171;
}

.log-line.success {
    color: #4ade80;
}

.log-line.ai {
    color: #c084fc;
}

.log-line.warning {
    color: #fbbf24;
}

.log-line.info {
    color: #7dd3fc;
}

/* Help Drawer - Nielsen Heuristic #10 */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
}

.help-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.help-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 550px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.8);
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.help-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-close-drawer {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.3s;
}

.btn-close-drawer:hover {
    color: var(--error);
}

.drawer-content {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.drawer-content .intro {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.98rem;
}

.drawer-section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-list {
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.step-list li strong {
    color: var(--text-primary);
}

.action-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-top: 0.75rem;
}

.action-card ol {
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.action-card ol li strong {
    color: var(--text-primary);
}

.action-card ol a {
    color: var(--info);
    text-decoration: none;
}

.action-card ol a:hover {
    text-decoration: underline;
}

.badge-critical {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tip {
    font-size: 0.82rem;
    margin-top: 1rem;
    color: #a5b4fc;
    display: flex;
    gap: 0.4rem;
}

.faq-item {
    margin-bottom: 1.25rem;
}

.faq-item h4 {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.faq-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Footer Section */
.app-footer-bar {
    text-align: center;
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Helper Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Animation Declarations */
@keyframes glow-pulse {
    0% {
        box-shadow: 0 0 4px var(--success);
        transform: scale(0.9);
    }

    100% {
        box-shadow: 0 0 12px var(--success);
        transform: scale(1.1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Code.gs dialog (<dialog> nativo) */
.code-dialog {
    width: min(800px, 92vw);
    max-height: 90vh;
    margin: auto;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.code-dialog::backdrop {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.code-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.code-dialog-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.code-dialog-hint {
    padding: 0.75rem 1.5rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.code-dialog-hint a {
    color: var(--info);
}

.code-source {
    display: block;
    width: calc(100% - 3rem);
    height: min(50vh, 420px);
    margin: 1rem 1.5rem;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--text-console);
    background: var(--bg-console);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
    outline: none;
}

.code-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem 1.25rem;
}

.btn-copy-code {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-copy-code:hover {
    background: var(--primary-light);
}

.btn-copy-code.copied {
    background: var(--success);
}

.code-dialog-github {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Button Link Inline */
.btn-link-inline {
    background: none;
    border: none;
    color: var(--primary-light);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0;
    margin-left: 0.5rem;
    transition: color 0.2s ease;
}

.btn-link-inline:hover {
    color: var(--primary);
}