/* ════════════════════════════════════════════════════════
   CALC BY ANDRERER — GLOBAL STYLESHEET
   ════════════════════════════════════════════════════════ */

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

body {
    font-family: 'Inter', Arial, sans-serif;
    background: #0d0d14;
    color: #e0e0f0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── ANIMATED BACKGROUND ORBS ─── */
.bg-orbs {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    animation: drift 18s ease-in-out infinite alternate;
}
.orb-1 { width: 520px; height: 520px; background: #4f46e5; top: -140px; left: -120px; animation-duration: 20s; }
.orb-2 { width: 400px; height: 400px; background: #7c3aed; bottom: -100px; right: -80px; animation-duration: 25s; animation-delay: -8s; }
.orb-3 { width: 300px; height: 300px; background: #2563eb; top: 40%; left: 50%; animation-duration: 22s; animation-delay: -4s; }

@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(40px, 30px) scale(1.08); }
}

/* ─── LAYOUT ─── */
.page-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 20px 60px;
}

/* ─── FIXED CORNER LOGO (sub-pages) ─── */
.new-logo {
    position: fixed;
    top: 18px;
    left: 18px;
    width: 44px;
    z-index: 100;
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.5));
}

/* ─── LANDING PAGE HEADER ─── */
.site-header {
    text-align: center;
    margin-bottom: 52px;
    animation: fadeUp 0.7s ease both;
}
.logo-img {
    width: 90px;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 18px rgba(139, 92, 246, 0.55));
}
.site-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}
.site-header p {
    margin-top: 10px;
    font-size: 1rem;
    color: #8b8ba8;
    font-weight: 400;
}

/* ─── MAIN CONTAINER (sub-pages) ─── */
.container {
    width: 100%;
    max-width: 520px;
    padding: 32px 28px;
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
    backdrop-filter: blur(14px);
    animation: fadeUp 0.5s 0.1s ease both;
}

.calculator-container { max-width: 360px; }
.unit-converter       { max-width: 520px; }

/* ─── HEADINGS ─── */
h1 {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 28px;
    letter-spacing: -0.3px;
}

h2 {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b6b8a;
    margin: 28px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ─── BACK LINK ─── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #a78bfa;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 24px;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(139,92,246,0.1);
    border: 1px solid rgba(139,92,246,0.2);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.back-link:hover {
    background: rgba(139,92,246,0.22);
    color: #c4b5fd;
    border-color: rgba(139,92,246,0.4);
}

/* ─── FORM ELEMENTS ─── */
.input-group {
    display: flex;
    align-items: center;
    margin: 10px 0;
}

label {
    flex: 0 0 130px;
    font-weight: 500;
    font-size: 0.85rem;
    color: #8b8baa;
    margin-top: 0;
}

input {
    flex: 1;
    width: 100%;
    padding: 10px 12px;
    margin-top: 0;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: #e0e0f0;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

input:focus {
    border-color: rgba(139,92,246,0.6);
    background: rgba(255,255,255,0.09);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.12);
}

select {
    flex: 1;
    width: 100%;
    height: 40px;
    padding: 0 30px 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: #e0e0f0;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e0e0e0' d='M10 4H2L6 8Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s, background 0.2s;
}

select:focus {
    border-color: rgba(139,92,246,0.6);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.12);
}

hr {
    border: 0;
    border-top: 1px solid rgba(255,255,255,0.07);
    margin: 24px 0;
}

/* ─── BUTTONS ─── */
button { font-family: inherit; cursor: pointer; }

.operator-btn, .clear-btn {
    flex: 1;
    padding: 11px 16px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.operator-btn {
    background: rgba(139,92,246,0.2);
    color: #c4b5fd;
    border: 1px solid rgba(139,92,246,0.28);
}
.operator-btn:hover {
    background: rgba(139,92,246,0.35);
    color: #ede9fe;
}

.clear-btn {
    background: rgba(255,255,255,0.07);
    color: #9090b0;
    border: 1px solid rgba(255,255,255,0.09);
}
.clear-btn:hover {
    background: rgba(255,255,255,0.13);
    color: #e0e0f0;
}

.math-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* ─── CALCULATOR ─── */
.calculator {
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    padding: 14px;
    background: rgba(0,0,0,0.2);
}

.display {
    width: 100%;
    height: 64px;
    margin-bottom: 12px;
    padding: 0 16px;
    text-align: right;
    font-size: 2.2em;
    font-weight: 600;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    color: #e0e0f0;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.calculator button {
    padding: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    color: #e0e0f0;
    background: rgba(255,255,255,0.07);
}
.calculator button:hover {
    background: rgba(255,255,255,0.13);
    transform: scale(1.04);
}

.number, .decimal { background: rgba(255,255,255,0.08); }
.number:hover, .decimal:hover { background: rgba(255,255,255,0.15); }

.operator, .equal {
    background: rgba(139,92,246,0.18);
    color: #c4b5fd;
    border-color: rgba(139,92,246,0.22);
}
.operator:hover, .equal:hover {
    background: rgba(139,92,246,0.32);
    color: #ede9fe;
}

.clear {
    background: rgba(239,68,68,0.13);
    color: #fca5a5;
    border-color: rgba(239,68,68,0.18);
    grid-column: span 2;
}
.clear:hover {
    background: rgba(239,68,68,0.24);
    color: #fecaca;
}

.zero { grid-column: span 2; }

/* ─── RESULT DISPLAYS ─── */
.result-display {
    background: rgba(139,92,246,0.08);
    border: 1px solid rgba(139,92,246,0.14);
    padding: 18px;
    border-radius: 14px;
    text-align: center;
    font-weight: 600;
    color: #a78bfa;
    margin-top: 20px;
}

#results {
    margin-top: 24px;
    padding: 16px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.07);
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.result-item:last-child { border-bottom: none; }

.result-value { font-weight: 600; color: #e0e0f0; font-size: 1.05em; }
.result-unit  { color: #a78bfa; font-weight: 500; }

/* ─── DISCLAIMER ─── */
.disclaimer {
    width: 90%;
    margin: 30px auto 0;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    font-size: 0.75rem;
    line-height: 1.5;
    color: #55556a;
    text-align: justify;
}
.disclaimer strong { color: #8b8ba8; }

/* ─── SEARCH BAR (landing page) ─── */
.search-wrap {
    width: 100%;
    max-width: 480px;
    margin-bottom: 44px;
    animation: fadeUp 0.7s 0.1s ease both;
}

.search-box { position: relative; }

.search-box svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b6b8a;
    pointer-events: none;
}

#search-input {
    width: 100%;
    flex: unset;
    margin-top: 0;
    padding: 14px 16px 14px 46px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    color: #e0e0f0;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
    backdrop-filter: blur(8px);
}
#search-input::placeholder { color: #5a5a78; }
#search-input:focus {
    border-color: rgba(139,92,246,0.6);
    background: rgba(255,255,255,0.09);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

/* ─── CARD GRID (landing page) ─── */
.card-grid {
    display: grid;
    width: 100%;
    max-width: 860px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    animation: fadeUp 0.7s 0.18s ease both;
}

.nav-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 22px 20px;
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 18px;
    text-decoration: none;
    color: inherit;
    backdrop-filter: blur(12px);
    transition: transform 0.22s cubic-bezier(.34,1.56,.64,1),
                box-shadow 0.22s ease,
                background 0.22s ease,
                border-color 0.22s ease;
    overflow: hidden;
}

.nav-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(139,92,246,0.12), transparent 60%);
    opacity: 0;
    transition: opacity 0.25s;
    border-radius: inherit;
}

.nav-card:hover {
    transform: translateY(-5px) scale(1.015);
    background: rgba(255,255,255,0.09);
    border-color: rgba(139,92,246,0.4);
    box-shadow: 0 16px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(139,92,246,0.15);
}
.nav-card:hover::before { opacity: 1; }
.nav-card.hidden { display: none; }

.nav-icon-wrap {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139,92,246,0.18);
    border: 1px solid rgba(139,92,246,0.25);
    transition: background 0.22s, transform 0.22s;
}
.nav-card:hover .nav-icon-wrap {
    background: rgba(139,92,246,0.32);
    transform: scale(1.08);
}
.nav-icon-wrap svg { width: 22px; height: 22px; stroke: #a78bfa; }

.nav-card-content { flex: 1; min-width: 0; }

.nav-card-content h3 {
    font-size: 0.98rem;
    font-weight: 600;
    color: #e8e8f8;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: none;
    -webkit-text-fill-color: #e8e8f8;
}

.nav-card-content p {
    font-size: 0.8rem;
    color: #7a7a9a;
    line-height: 1.4;
}

.badge-ext {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #a78bfa;
    background: rgba(139,92,246,0.15);
    border: 1px solid rgba(139,92,246,0.25);
    border-radius: 6px;
    padding: 2px 6px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#no-results {
    display: none;
    grid-column: 1/-1;
    text-align: center;
    color: #5a5a78;
    font-size: 0.95rem;
    padding: 40px 0;
}

/* ─── SITE FOOTER ─── */
.site-footer {
    margin-top: 60px;
    font-size: 0.78rem;
    color: #3d3d56;
    text-align: center;
    animation: fadeUp 0.7s 0.3s ease both;
}
.site-footer a { color: #5a5a78; text-decoration: none; }
.site-footer a:hover { color: #a78bfa; }

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Staggered card entrance */
.nav-card:nth-child(1)  { animation: fadeUp 0.5s 0.20s ease both; }
.nav-card:nth-child(2)  { animation: fadeUp 0.5s 0.27s ease both; }
.nav-card:nth-child(3)  { animation: fadeUp 0.5s 0.34s ease both; }
.nav-card:nth-child(4)  { animation: fadeUp 0.5s 0.41s ease both; }
.nav-card:nth-child(5)  { animation: fadeUp 0.5s 0.48s ease both; }
.nav-card:nth-child(6)  { animation: fadeUp 0.5s 0.55s ease both; }
.nav-card:nth-child(7)  { animation: fadeUp 0.5s 0.62s ease both; }
.nav-card:nth-child(8)  { animation: fadeUp 0.5s 0.69s ease both; }
.nav-card:nth-child(9)  { animation: fadeUp 0.5s 0.76s ease both; }
.nav-card:nth-child(10) { animation: fadeUp 0.5s 0.83s ease both; }
.nav-card:nth-child(11) { animation: fadeUp 0.5s 0.90s ease both; }
.nav-card:nth-child(12) { animation: fadeUp 0.5s 0.97s ease both; }
.nav-card:nth-child(13) { animation: fadeUp 0.5s 1.04s ease both; }

/* ─── RESPONSIVE ─── */
@media (max-width: 540px) {
    .card-grid { grid-template-columns: 1fr 1fr; }
    .nav-card { flex-direction: column; gap: 12px; padding: 18px 14px; }
    .nav-card-content h3 { font-size: 0.88rem; white-space: normal; }
    .container { padding: 24px 16px; }
    label { flex: 0 0 100px; font-size: 0.8rem; }
}

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