/* ============================================
   CALCULADORA DE SUBREDES - CLEAN CORPORATE BENTO UI
   MASR Tech Group - 2026
   ============================================ */

/* === Design Tokens === */
:root {
    /* Brand Palette - MASR Corporate */
    --brand-primary: #2563EB;
    --brand-primary-hover: #1D4ED8;
    --brand-secondary: #0284C7;
    --brand-accent: #38BDF8;
    --brand-glow: rgba(37, 99, 235, 0.15);

    /* Clean Corporate Dark Foundation */
    --bg-base: #0B1120;
    --bg-surface: rgba(15, 23, 42, 0.75);
    --bg-surface-elevated: rgba(30, 41, 59, 0.5);
    --bg-input: rgba(11, 17, 32, 0.7);
    --bg-hover: rgba(56, 189, 248, 0.05);

    /* Text Colors */
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-accent: #38BDF8;

    /* Subtle Borders (Non-brutalist) */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(56, 189, 248, 0.25);
    --border-focus: #3B82F6;

    /* Functional Colors */
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-error: #F43F5E;
    --color-info: #0EA5E9;

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Border Radius (Bento standard) */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;

    /* Soft, Diffused Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.45);

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;

    /* Micro-interaction Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
}

/* === Reset & Base Styles === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-base);
    background-image: radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.08) 0%, transparent 60%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Corporate Header === */
.header {
    background: rgba(11, 17, 32, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 14px 24px;
}

.header-content {
    max-width: 1320px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.brand-title {
    font-weight: 600;
    font-size: 1.25rem;
    color: #38BDF8;
    letter-spacing: -0.01em;
    user-select: none;
}

.header-spacer {
    width: 68px;
    height: 1px;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.logo-link:hover {
    opacity: 0.9;
}

.logo {
    height: 42px;
    width: auto;
    display: block;
}

.main-title {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    flex: 1;
    text-align: center;
}

/* Language Switcher */
.lang-switcher {
    display: inline-flex;
    padding: 3px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    gap: 2px;
}

.lang-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lang-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.lang-btn.active {
    background: var(--brand-primary);
    color: #FFFFFF;
    font-weight: 500;
    box-shadow: var(--shadow-xs);
}

/* === Main Container === */
.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 32px 24px 48px;
    flex: 1;
    width: 100%;
}

/* === Segmented Tabs === */
.tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin-bottom: 24px;
    max-width: 100%;
    overflow-x: auto;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
}

.tab-icon {
    font-size: 1rem;
    opacity: 0.85;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border-color: rgba(56, 189, 248, 0.25);
    box-shadow: var(--shadow-xs);
}

/* Tab Panels */
.tab-content {
    display: none;
    animation: fadeIn 0.2s ease-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Main Bento Container Card === */
.calc-card {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    padding: 32px;
    box-shadow: var(--shadow-md);
}

.calc-card h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: 24px;
    font-weight: 400;
}

/* === Form Controls === */
.calc-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-field {
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal), background-color var(--transition-normal);
}

.input-field:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    background: rgba(15, 23, 42, 0.95);
}

.input-field::placeholder {
    color: var(--text-muted);
}

textarea.input-field {
    resize: vertical;
    min-height: 96px;
    line-height: 1.5;
}

.input-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Primary Action Button */
.btn-primary {
    align-self: flex-start;
    padding: 10px 22px;
    background: var(--brand-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: #FFFFFF;
    font-family: var(--font-primary);
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    margin-top: 4px;
}

.btn-primary:hover {
    background: var(--brand-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

/* === Bento Box Results Layout === */
.results-container {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.result-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.result-section h3 {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Bento Grid */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.result-item {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    transition: border-color var(--transition-normal), transform var(--transition-normal);
}

.result-item:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.result-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-value {
    font-family: var(--font-mono);
    font-size: 0.98rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    word-break: break-all;
}

.result-value.highlight {
    color: var(--brand-accent);
    font-weight: 600;
}

.result-value.binary {
    font-size: 0.88rem;
    line-height: 1.6;
    letter-spacing: 0.02em;
}

/* Binary Visualization Card */
.binary-visual {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 12px 14px;
    background: rgba(11, 17, 32, 0.7);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.bit {
    padding: 3px 5px;
    border-radius: 4px;
    font-weight: 500;
    transition: background var(--transition-fast);
}

.bit.network {
    background: rgba(56, 189, 248, 0.16);
    color: var(--brand-accent);
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.bit.host {
    background: rgba(148, 163, 184, 0.1);
    color: #CBD5E1;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

/* === VLSM Data Table === */
.vlsm-table {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: rgba(11, 17, 32, 0.5);
}

.vlsm-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
    text-align: left;
}

.vlsm-table th {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.vlsm-table td {
    padding: 11px 14px;
    font-family: var(--font-mono);
    font-size: 0.86rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.vlsm-table tr:hover td {
    background: var(--bg-hover);
}

.vlsm-table tr:last-child td {
    border-bottom: none;
}

/* === Alert Boxes === */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    border: 1px solid transparent;
}

.alert.error {
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.25);
    color: #FDA4AF;
}

.alert.warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
    color: #FCD34D;
}

.alert.success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.25);
    color: #6EE7B7;
}

.alert.info {
    background: rgba(14, 165, 233, 0.08);
    border-color: rgba(14, 165, 233, 0.25);
    color: #7DD3FC;
}

/* === Copy Button === */
.copy-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-xs);
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.copy-btn:hover {
    color: var(--brand-accent);
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.2);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn.copied {
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
}

/* Tooltip for copy */
.copy-btn::after {
    content: 'Copied!';
    position: absolute;
    background: #1E293B;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #F8FAFC;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-family: var(--font-primary);
    font-weight: 500;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.copy-btn.copied::after {
    opacity: 1;
}

/* === Real-Time Validation Feedback === */
.input-field.valid {
    border-color: rgba(16, 185, 129, 0.6);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.input-field.invalid {
    border-color: rgba(244, 63, 94, 0.6);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.12);
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* === Corporate Anchored Footer === */
footer, .footer {
    margin-top: auto;
    flex-shrink: 0;
    background: rgba(11, 17, 32, 0.95);
    border-top: 1px solid var(--border-subtle);
    padding: 20px 24px;
    text-align: center;
}

footer p, .footer p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 400;
}

footer a, .footer a {
    color: var(--brand-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

footer a:hover, .footer a:hover {
    color: #93C5FD;
    text-decoration: underline;
}

/* === Responsive Design === */
@media (max-width: 900px) {
    .header-spacer {
        display: none;
    }

    .header-content {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .main-title {
        order: 3;
        width: 100%;
        text-align: left;
        font-size: 1.1rem;
        margin-top: 6px;
    }

    .container {
        padding: 20px 16px 36px;
    }

    .calc-card {
        padding: 20px;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .header {
        padding: 12px 16px;
    }

    .logo {
        height: 34px;
    }

    .tabs {
        width: 100%;
    }

    .tab-btn {
        flex: 1;
        justify-content: center;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .btn-primary {
        width: 100%;
        text-align: center;
    }
}

/* === SEO Educational Content (Bento Box Style) === */
.seo-educational-content {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
    width: calc(100% - 48px);
    transition: border-color var(--transition-normal);
}

.seo-educational-content:hover {
    border-color: var(--border-hover);
}

.seo-educational-content strong {
    color: var(--brand-accent);
}

@media (max-width: 768px) {
    .seo-educational-content {
        width: calc(100% - 32px);
        margin: 28px auto !important;
        padding: 20px !important;
    }
}

/* === Subtle Scrollbars === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xs);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
