/* ============================================
   CONVERSOR DE DUREZAS - STYLES
   Premium dark design with glassmorphism
   ============================================ */

/* --- CSS Custom Properties --- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,400&family=Rubik:wght@300;400;500;700&display=swap');

:root {
    --bg-primary: #050a15;
    --bg-secondary: #0a1122;
    --bg-card: rgba(15, 25, 45, 0.7);
    --bg-card-hover: rgba(20, 35, 60, 0.8);
    --glass-border: rgba(32, 57, 141, 0.25);
    --glass-shadow: rgba(0, 0, 0, 0.5);

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --accent-primary: #20398d;
    /* UMI Corporate Blue (Official) */
    --accent-secondary: #003388;
    --accent-tertiary: #64748b;
    /* Industrial Grey */
    --accent-success: #10b981;
    --accent-warning: #f59e0b;

    --gradient-primary: linear-gradient(135deg, #20398d, #003388);
    --gradient-secondary: linear-gradient(135deg, #1e293b, #334155);
    --gradient-bg: linear-gradient(180deg, #050a15 0%, #0a1122 50%, #080e1a 100%);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    --font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    background-image: var(--gradient-bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Background Particles --- */
.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    filter: blur(1px);
    animation: float 20s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.6;
    }

    90% {
        opacity: 0.6;
    }

    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* --- Glass Card --- */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 32px var(--glass-shadow);
    transition: all var(--transition-normal);
}

.glass-card:hover {
    border-color: rgba(32, 57, 141, 0.4);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

/* --- Header --- */
.header {
    background: rgba(10, 15, 30, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 24px 0;
    margin-bottom: 30px;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-icon {
    width: 110px;
    height: 85px;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.address {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 4px;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- Main Container --- */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 60px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* --- Section Titles --- */
.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-icon {
    font-size: 1.3rem;
}

/* --- Input Section --- */
.input-section {
    padding: 32px;
}

.input-group {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.select-wrapper,
.input-group-field {
    flex: 1;
    min-width: 250px;
}

.select-wrapper label,
.input-group-field label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

select,
input[type="number"] {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1rem;
    outline: none;
    transition: all var(--transition-fast);
}

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

select:focus,
input[type="number"]:focus {
    border-color: var(--accent-primary);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 3px rgba(32, 57, 141, 0.2);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

.input-with-unit {
    position: relative;
}

.unit-badge {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gradient-primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    color: white;
    letter-spacing: 0.04em;
    pointer-events: none;
}

.input-with-unit input {
    padding-right: 70px;
}

/* --- Convert Button --- */
.convert-btn {
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 30px;
    color: white;
    font-weight: 700;
    font-family: var(--font-family);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
}

.convert-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.35);
}

.convert-btn:hover::before {
    left: 100%;
}

.convert-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.2rem;
    transition: transform var(--transition-fast);
}

.convert-btn:hover .btn-icon {
    transform: translateX(3px);
}

/* --- Range Info --- */
.range-info {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
    padding: 10px 14px;
    background: rgba(99, 102, 241, 0.06);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(99, 102, 241, 0.08);
    transition: all var(--transition-fast);
}

.range-info.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.range-info.error .range-icon {
    color: #ef4444;
}

.range-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* --- Material Note --- */
.material-note {
    margin-top: 12px;
    padding: 14px 18px;
    background: rgba(32, 57, 141, 0.12);
    border-left: 4px solid var(--accent-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    animation: fadeIn 0.3s ease-out;
}

.material-note strong {
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.note-icon {
    margin-right: 6px;
    font-size: 1rem;
    vertical-align: middle;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Results Section --- */
.results-section {
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

/* --- Result Card --- */
.result-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    animation: cardAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.result-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.result-card:hover::before {
    opacity: 1;
}

.result-card.active-scale {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.08);
}

.result-card.active-scale::before {
    opacity: 1;
}

.result-card.na {
    opacity: 0.45;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }
}

.result-card:nth-child(1) {
    animation-delay: 0.05s;
}

.result-card:nth-child(2) {
    animation-delay: 0.1s;
}

.result-card:nth-child(3) {
    animation-delay: 0.15s;
}

.result-card:nth-child(4) {
    animation-delay: 0.2s;
}

.result-card:nth-child(5) {
    animation-delay: 0.25s;
}

.result-card:nth-child(6) {
    animation-delay: 0.3s;
}

.result-card:nth-child(7) {
    animation-delay: 0.35s;
}

.result-card:nth-child(8) {
    animation-delay: 0.4s;
}

.result-card:nth-child(9) {
    animation-delay: 0.45s;
}

.result-card:nth-child(10) {
    animation-delay: 0.5s;
}

.result-card:nth-child(11) {
    animation-delay: 0.55s;
}

.result-card:nth-child(12) {
    animation-delay: 0.6s;
}

.result-card:nth-child(13) {
    animation-delay: 0.65s;
}

.result-scale {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.result-value {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.result-value.na-value {
    font-size: 1.1rem;
    font-weight: 500;
    background: none;
    -webkit-text-fill-color: var(--text-muted);
    color: var(--text-muted);
}

.result-name {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
}

.result-test-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(99, 102, 241, 0.08);
}

.test-badge {
    font-size: 0.68rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1.4;
}

.indenter-badge {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.load-badge {
    background: rgba(168, 85, 247, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(168, 85, 247, 0.12);
}

.ratio-badge {
    background: rgba(52, 211, 153, 0.08);
    color: var(--text-secondary);
    border: 1px solid rgba(52, 211, 153, 0.12);
}

.brinell-variant {
    border-left: 4px solid #6366f1;
}

/* --- Brinell Section --- */
.brinell-section-header {
    grid-column: 1 / -1;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 14px 0 4px;
    margin-top: 8px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.brinell-section-icon {
    font-size: 1.1rem;
}

.brinell-group-label {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-left: 4px solid #6366f1;
    background: rgba(20, 20, 50, 0.5);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    flex-wrap: wrap;
}

.group-ratio {
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.group-material {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.group-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* Brinell params inside each variant card */
.brinell-params {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(99, 102, 241, 0.08);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.param-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 8px;
}

.param-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.param-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.param-divider {
    width: 1px;
    background: rgba(99, 102, 241, 0.12);
    align-self: stretch;
}

.param-ball .param-value {
    color: #6366f1;
}

.param-load .param-value {
    color: #a855f7;
}

.param-material .param-value {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* --- Table Section --- */
.table-section {
    padding: 24px 32px;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.table-header .section-title {
    margin-bottom: 0;
}

.toggle-btn {
    padding: 8px 18px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.toggle-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.chevron {
    transition: transform var(--transition-normal);
    font-size: 0.7rem;
}

.chevron.open {
    transform: rotate(180deg);
}

.table-container {
    margin-top: 20px;
    animation: slideUp 0.4s ease;
}

.table-scroll {
    overflow-x: auto; /* Solo scroll horizontal si la tabla es más ancha que la pantalla */
    border-radius: var(--radius-md);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.table-scroll::-webkit-scrollbar {
    height: 6px;
}

.table-scroll::-webkit-scrollbar-track {
    background: rgba(10, 10, 30, 0.5);
}

.table-scroll::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    position: sticky;
    top: 0; /* Fija al hacer scroll de página */
    z-index: 50;
    padding: 14px 18px;
    background: var(--accent-secondary);
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    text-align: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

td {
    padding: 11px 18px;
    text-align: center;
    border-bottom: 1px solid rgba(99, 102, 241, 0.06);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    font-weight: 400;
    white-space: nowrap;
}

td.na-cell {
    color: var(--text-muted);
    opacity: 0.4;
}

tr:hover td {
    background: rgba(99, 102, 241, 0.04);
    color: var(--text-primary);
}

tr.highlight td {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

/* --- Info Section --- */
.info-section {
    padding: 28px 32px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.info-card {
    padding: 20px;
    background: rgba(10, 10, 30, 0.5);
    border: 1px solid rgba(99, 102, 241, 0.08);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.info-card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.04);
}

.info-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 8px;
}

.info-card p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.disclaimer {
    padding: 16px 20px;
    background: rgba(251, 191, 36, 0.06);
    border: 1px solid rgba(251, 191, 36, 0.15);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.disclaimer strong {
    color: var(--accent-warning);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 24px;
    font-size: 0.76rem;
    color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
    position: relative;
    z-index: 1;
}

/* --- Error State --- */
.error-shake {
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(6px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

input.error {
    border-color: var(--accent-tertiary) !important;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15) !important;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .header-content {
        padding: 14px 16px;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .main-container {
        padding: 20px 14px 36px;
        gap: 20px;
    }

    .input-section,
    .table-section,
    .info-section {
        padding: 22px 18px;
    }

    .input-group {
        flex-direction: column;
    }

    .select-wrapper,
    .value-wrapper {
        min-width: 100%;
    }

    .convert-btn {
        width: 100%;
        justify-content: center;
        padding: 16px;
    }

    .results-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }

    .result-value {
        font-size: 1.6rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .results-grid {
        grid-template-columns: 1fr 1fr;
    }

    .result-card {
        padding: 16px 18px;
    }
}