/* ==============================
   Geometric Shapes Calculator
   Dark Gradient UI
================================ */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

:root {
    --background: #090d18;
    --surface: #111827;
    --border: rgba(255, 255, 255, 0.09);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 45px 20px 25px;
    min-height: 100vh;
    direction: rtl;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    color: var(--text);
    background:
        radial-gradient(ellipse at 10% 5%, rgba(99, 102, 241, .14), transparent 35%),
        radial-gradient(ellipse at 90% 35%, rgba(14, 165, 233, .09), transparent 35%),
        var(--background);
}

/* Header */

.page-header {
    max-width: 760px;
    margin: 0 auto 40px;
    text-align: center;
}

h1 {
    margin: 0;
    font-size: clamp(25px, 4vw, 38px);
    font-weight: 800;
    line-height: 1.8;
    background: linear-gradient(100deg, #a5b4fc, #67e8f9, #c4b5fd);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.page-header > p {
    margin: 12px auto 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 2;
}

h1::after {
    content: "";
    display: block;
    width: 85px;
    height: 4px;
    margin: 10px auto 0;
    border-radius: 20px;
    background: linear-gradient(90deg, #818cf8, #22d3ee);
}

/* Vertical cards */

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

/* Base card style */

.shape-card {
    --accent: #818cf8;
    --accent-light: #c7d2fe;
    --glow: rgba(129, 140, 248, .13);

    position: relative;
    isolation: isolate;
    overflow: hidden;
    width: 100%;
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, #192235, #0f1624);
    box-shadow: 0 15px 40px rgba(0, 0, 0, .18);
    transition: transform .25s ease, border-color .25s ease,
                box-shadow .25s ease;
}

.shape-card::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -75px;
    left: -65px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: var(--glow);
    filter: blur(35px);
    pointer-events: none;
}

.shape-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 20px 50px var(--glow);
}

/* Individual colors */

#rectangle {
    --accent: #38bdf8;
    --accent-light: #bae6fd;
    --glow: rgba(56, 189, 248, .13);
}

#square {
    --accent: #34d399;
    --accent-light: #a7f3d0;
    --glow: rgba(52, 211, 153, .13);
}

#triangle {
    --accent: #fbbf24;
    --accent-light: #fde68a;
    --glow: rgba(251, 191, 36, .13);
}

#trapezoid {
    --accent: #fb7185;
    --accent-light: #fecdd3;
    --glow: rgba(251, 113, 133, .13);
}

#rhombus {
    --accent: #c084fc;
    --accent-light: #e9d5ff;
    --glow: rgba(192, 132, 252, .13);
}

#parallelogram {
    --accent: #2dd4bf;
    --accent-light: #99f6e4;
    --glow: rgba(45, 212, 191, .13);
}

#circle {
    --accent: #fb923c;
    --accent-light: #fed7aa;
    --glow: rgba(251, 146, 60, .13);
}

#sphere {
    --accent: #818cf8;
    --accent-light: #c7d2fe;
    --glow: rgba(129, 140, 248, .15);
}

/* Shape headings */

.shape-card h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 27px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: var(--accent-light);
    font-size: 22px;
    font-weight: 800;
}

.shape-card h2::before {
    content: "";
    display: inline-block;
    flex: 0 0 43px;
    width: 43px;
    height: 43px;
    border: 1px solid var(--accent);
    border-radius: 13px;
    background: var(--glow);
}

/* Shape icons */

#rectangle h2::before {
    content: "▱";
}

#square h2::before {
    content: "□";
}

#triangle h2::before {
    content: "△";
}

#trapezoid h2::before {
    content: "⏢";
}

#rhombus h2::before {
    content: "◇";
}

#parallelogram h2::before {
    content: "▱";
}

#circle h2::before {
    content: "◉";
}

#sphere h2::before {
    content: "●";
}

.shape-card h2::before {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 25px;
    font-weight: 700;
}

/* Labels */

.shape-card label {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 19px;
    color: #dbe4f0;
    font-size: 14px;
    font-weight: 600;
}

/* Inputs */

.shape-card input[type="number"] {
    width: 100%;
    min-width: 0;
    height: 49px;
    padding: 0 15px;
    outline: none;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 12px;
    background: rgba(8, 13, 25, .65);
    color: #f8fafc;
    font-family: inherit;
    font-size: 14px;
    direction: rtl;
    transition: border-color .2s ease, box-shadow .2s ease,
                background .2s ease;
}

.shape-card input::placeholder {
    color: #64748b;
}

.shape-card input:hover {
    border-color: rgba(148, 163, 184, .45);
}

.shape-card input:focus {
    border-color: var(--accent);
    background: rgba(8, 13, 25, .9);
    box-shadow: 0 0 0 3px var(--glow);
}

/* Multiple side inputs */

.triangle-sides,
.side-inputs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: -7px 0 22px;
}

.side-inputs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.triangle-sides input,
.side-inputs input {
    text-align: center;
    padding: 0 8px;
}

/* Calculate button */

.shape-card button {
    display: block;
    width: 100%;
    min-height: 49px;
    margin-top: 5px;
    padding: 12px 18px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(110deg, var(--accent), var(--accent-light));
    color: #101522;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 7px 20px var(--glow);
    transition: transform .2s ease, filter .2s ease,
                box-shadow .2s ease;
}

.shape-card button:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px var(--glow);
}

.shape-card button:active {
    transform: scale(.99);
}

/* Results */

.result {
    min-height: 58px;
    margin-top: 22px;
    padding: 16px 18px;
    border: 1px solid rgba(148, 163, 184, .12);
    border-right: 3px solid var(--accent);
    border-radius: 12px;
    background: rgba(8, 13, 25, .48);
}

.result p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 2;
    overflow-wrap: anywhere;
}

.result p + p {
    margin-top: 7px;
}

.result template {
    color: var(--text);
}

/* Footer */

.page-footer {
    max-width: 760px;
    margin: 35px auto 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    text-align: center;
}

.page-footer p {
    margin: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 2;
}

/* Responsive */

@media (max-width: 600px) {
    body {
        padding: 28px 13px 22px;
    }

    .page-header {
        margin-bottom: 28px;
    }

    h1 {
        font-size: 25px;
    }

    .page-header > p {
        font-size: 13px;
    }

    #app {
        gap: 17px;
    }

    .shape-card {
        padding: 22px 17px;
        border-radius: 18px;
    }

    .shape-card h2 {
        margin-bottom: 23px;
        font-size: 19px;
    }

    .shape-card h2::before {
        flex-basis: 39px;
        width: 39px;
        height: 39px;
        border-radius: 11px;
    }

    .triangle-sides,
    .side-inputs {
        gap: 7px;
    }

    .triangle-sides input,
    .side-inputs input {
        padding: 0 5px;
        font-size: 12px;
    }

    .result {
        padding: 14px;
    }
}

@media (max-width: 360px) {
    .shape-card {
        padding: 19px 13px;
    }

    .side-inputs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}