* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #6a11cb;
    --secondary: #2575fc;
    --accent: #8a2be2;
    --light: #f8f9fa;
    --dark: #333;
    --gray: #666;
    --border: #ddd;
    --table-header: #5d10b5;
    --table-row: #f0e6ff;
    --white: #ffffff;
}

body {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--dark);
    min-height: 100vh;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    max-width: 900px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 25px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 90vh;
}

header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

h1 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 2rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    color: var(--gray);
    font-size: 1.1rem;
}

.input-section {
    margin-bottom: 25px;
    padding: 20px;
    background-color: var(--light);
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #444;
    font-size: 1rem;
}

input[type="number"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

input[type="number"]:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.15);
}

.input-hint {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 6px;
    font-style: italic;
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin: 18px 0;
    padding: 8px 0;
}

input[type="checkbox"] {
    margin-right: 12px;
    transform: scale(1.3);
    accent-color: var(--primary);
}

.checkbox-group label {
    margin-bottom: 0;
    font-weight: 500;
    cursor: pointer;
}

button {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 5px 12px rgba(106, 17, 203, 0.25);
    width: 100%;
    margin-top: 10px;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(106, 17, 203, 0.35);
}

button:active {
    transform: translateY(0);
}

.results-section {
    margin-top: 25px;
    flex-grow: 1;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.results-header h2 {
    font-size: 1.4rem;
    color: var(--primary);
}

.results-count {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.95rem;
    background-color: #f0e6ff;
    padding: 6px 12px;
    border-radius: 20px;
}

.results-container {
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 15px;
    background-color: var(--light);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: var(--table-header);
    color: white;
    position: sticky;
    top: 0;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

tr:nth-child(even) {
    background-color: var(--table-row);
}

tr:hover {
    background-color: #e6d9ff;
    transition: background-color 0.2s;
}

.no-results {
    text-align: center;
    padding: 30px 20px;
    color: var(--gray);
    font-style: italic;
    font-size: 1rem;
}

.info-section {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f0e6ff, #e1d0ff);
    border-radius: 12px;
    border-left: 6px solid var(--primary);
    font-size: 0.95rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.info-section h3 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.info-section p {
    line-height: 1.6;
    margin-bottom: 10px;
}

/* FOOTER STYLES */
footer {
    margin-top: 30px;
    padding: 20px 0 15px;
    border-top: 1px solid var(--border);
    color: var(--gray);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.footer-text p {
    margin: 0;
    text-align: center;
    font-size: 0.95rem;
}

.heart {
    color: #ff4d4d;
    animation: heartbeat 1.5s infinite;
    display: inline-block;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    5% { transform: scale(1.2); }
    10% { transform: scale(1); }
    15% { transform: scale(1.2); }
    20% { transform: scale(1); }
    100% { transform: scale(1); }
}

/* SHARE BUTTONS STYLES */
.share-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.share-text {
    font-weight: 600;
    color: var(--primary);
    margin: 0;
    font-size: 1rem;
}

.share-buttons {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.share-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    padding: 0;
    position: relative;
    overflow: hidden;
}

.share-btn svg {
    width: 22px;
    height: 22px;
    fill: white;
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease;
}

/* Warna WhatsApp - hijau cerah */
.whatsapp {
    background: linear-gradient(135deg, #25D366, #128C7E);
}

.whatsapp:hover {
    background: linear-gradient(135deg, #1ebe57, #0d7a6c);
    box-shadow: 0 6px 12px rgba(37, 211, 102, 0.35);
}

/* Warna Facebook - biru Facebook */
.facebook {
    background: linear-gradient(135deg, #1877F2, #0d65d9);
}

.facebook:hover {
    background: linear-gradient(135deg, #1466d4, #0b5ac2);
    box-shadow: 0 6px 12px rgba(24, 119, 242, 0.35);
}

/* Warna Twitter/X - biru Twitter */
.twitter {
    background: linear-gradient(135deg, #1DA1F2, #0d8bd9);
}

.twitter:hover {
    background: linear-gradient(135deg, #0d8bd9, #0a79c4);
    box-shadow: 0 6px 12px rgba(29, 161, 242, 0.35);
}

/* Warna Instagram - gradien khas Instagram */
.instagram {
    background: radial-gradient(circle at 30% 107%, 
        #fdf497 0%, 
        #fdf497 5%, 
        #fd5949 45%, 
        #d6249f 60%, 
        #285AEB 90%);
}

.instagram:hover {
    background: radial-gradient(circle at 30% 107%, 
        #fdf497 0%, 
        #fceb6b 5%, 
        #fd5949 45%, 
        #d6249f 60%, 
        #285AEB 90%);
    box-shadow: 0 6px 12px rgba(214, 36, 159, 0.35);
}

/* Warna Telegram - biru Telegram */
.telegram {
    background: linear-gradient(135deg, #0088cc, #006699);
}

.telegram:hover {
    background: linear-gradient(135deg, #0077b3, #005580);
    box-shadow: 0 6px 12px rgba(0, 136, 204, 0.35);
}

/* Warna Copy Link - sesuai tema utama */
.link {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.link:hover {
    background: linear-gradient(135deg, #5910a5, #1e64d4);
    box-shadow: 0 6px 12px rgba(106, 17, 203, 0.35);
}

/* Efek hover untuk semua tombol */
.share-btn:hover {
    transform: translateY(-3px) scale(1.1);
}

.share-btn:hover svg {
    transform: scale(1.15);
}

.share-btn:active {
    transform: translateY(0) scale(1);
}

/* Scrollbar styling */
.results-container::-webkit-scrollbar {
    width: 10px;
}

.results-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.results-container::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--primary), var(--secondary));
    border-radius: 10px;
}

.results-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(var(--secondary), var(--primary));
}

/* Loading animation */
.loader {
    display: none;
    text-align: center;
    padding: 15px;
    margin-top: 15px;
}

.loader-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

.loader p {
    color: var(--gray);
    font-size: 0.95rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ============ RESPONSIVE DESIGN ============ */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        max-width: 90%;
        padding: 22px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .share-btn {
        width: 44px;
        height: 44px;
    }
    
    .share-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* Tablet Kecil (576px - 768px) */
@media (max-width: 768px) {
    .container {
        max-width: 95%;
        padding: 20px;
    }
    
    h1 {
        font-size: 1.7rem;
    }
    
    .input-section {
        padding: 18px;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .results-container {
        max-height: 400px;
    }
    
    .share-buttons {
        gap: 12px;
    }
    
    .share-btn {
        width: 42px;
        height: 42px;
    }
}

/* Handphone (480px - 576px) */
@media (max-width: 576px) {
    body {
        padding: 10px;
        align-items: stretch;
    }
    
    .container {
        padding: 18px;
        border-radius: 12px;
        min-height: 95vh;
        max-width: 100%;
    }
    
    h1 {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .input-section {
        padding: 16px;
        margin-bottom: 20px;
    }
    
    input[type="number"] {
        padding: 12px 14px;
        font-size: 0.95rem;
    }
    
    .checkbox-group {
        margin: 15px 0;
    }
    
    input[type="checkbox"] {
        transform: scale(1.2);
    }
    
    button {
        padding: 14px 20px;
        font-size: 1rem;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .results-header h2 {
        font-size: 1.3rem;
    }
    
    .results-count {
        align-self: flex-start;
        font-size: 0.9rem;
        padding: 5px 10px;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 8px 6px;
    }
    
    .results-container {
        max-height: 350px;
        padding: 12px;
    }
    
    .info-section {
        padding: 16px;
        margin-top: 25px;
        font-size: 0.9rem;
    }
    
    footer {
        margin-top: 25px;
        padding: 18px 0 12px;
    }
    
    .footer-content {
        gap: 18px;
    }
    
    .footer-text p {
        font-size: 0.9rem;
    }
    
    .share-section {
        gap: 10px;
    }
    
    .share-text {
        font-size: 0.95rem;
    }
    
    .share-buttons {
        gap: 10px;
    }
    
    .share-btn {
        width: 40px;
        height: 40px;
    }
    
    .share-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .loader-spinner {
        width: 30px;
        height: 30px;
    }
}

/* Handphone Kecil (di bawah 480px) */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .input-section {
        padding: 14px;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 7px 5px;
    }
    
    th {
        font-size: 0.75rem;
    }
    
    .results-container {
        max-height: 320px;
        padding: 10px;
    }
    
    .share-buttons {
        gap: 8px;
    }
    
    .share-btn {
        width: 38px;
        height: 38px;
    }
    
    .share-btn svg {
        width: 17px;
        height: 17px;
    }
    
    .footer-text p {
        font-size: 0.85rem;
    }
}

/* Layar sangat kecil (di bawah 360px) */
@media (max-width: 360px) {
    h1 {
        font-size: 1.4rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    table {
        font-size: 0.7rem;
    }
    
    th, td {
        padding: 6px 4px;
    }
    
    th {
        font-size: 0.7rem;
    }
    
    .share-buttons {
        gap: 6px;
    }
    
    .share-btn {
        width: 36px;
        height: 36px;
    }
    
    .share-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .footer-text p {
        font-size: 0.8rem;
    }
}

/* Laptop Besar (di atas 1200px) */
@media (min-width: 1200px) {
    .container {
        max-width: 1000px;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .share-btn {
        width: 48px;
        height: 48px;
    }
    
    .share-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* Polesan aksesibilitas dan komponen baru */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hero {
    border-bottom-color: #e8e0f5;
}

.formula {
    display: inline-block;
    margin-top: 18px;
    padding: 10px 18px;
    border-radius: 999px;
    color: var(--primary);
    background: #f0e6ff;
    font: 700 1.35rem Georgia, serif;
    letter-spacing: .04em;
}

.main-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding: 5px;
    border-radius: 12px;
    background: #f3effa;
}

.nav-btn {
    width: auto;
    flex: 1;
    margin: 0;
    padding: 11px 14px;
    color: var(--primary);
    background: transparent;
    box-shadow: none;
    font-size: .92rem;
}

.nav-btn:hover,
.nav-btn.active {
    color: #fff;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    box-shadow: 0 4px 10px rgba(106, 17, 203, .2);
    transform: none;
}

.app-section {
    scroll-margin-top: 20px;
}

.calculator-section {
    margin-bottom: 25px;
    padding: 24px;
    border: 1px solid #e8e0f5;
    border-radius: 12px;
    background: linear-gradient(145deg, #fff, #faf8ff);
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.eyebrow {
    margin-bottom: 4px !important;
    color: var(--secondary);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.section-heading h2 {
    color: var(--primary);
    font-size: 1.5rem;
}

.section-description {
    margin-top: 6px;
    color: var(--gray);
    line-height: 1.5;
}

.section-badge {
    flex-shrink: 0;
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--primary);
    background: #f0e6ff;
    font-family: Georgia, serif;
    font-weight: 700;
}

.calculator-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, .9fr);
    gap: 24px;
    align-items: stretch;
}

.calculator-form {
    padding: 18px;
    border-radius: 10px;
    background: #f8f9fa;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.calculator-form .input-group {
    margin-bottom: 14px;
}

.calculator-form label {
    margin-bottom: 6px;
    font-size: .9rem;
}

.calculator-form input {
    width: 100%;
    padding: 11px 10px;
    border: 2px solid var(--border);
    border-radius: 7px;
    font-size: 1rem;
}

.field-hint,
.form-hint {
    display: block;
    margin-top: 5px;
    color: var(--gray);
    font-size: .75rem;
}

.form-hint {
    margin-bottom: 12px;
}

.calculator-form button {
    margin-top: 4px;
}

.secondary-btn {
    color: var(--primary);
    background: #fff;
    border: 1px solid #d8c8f0;
    box-shadow: none;
}

.secondary-btn:hover {
    color: #fff;
}

.calculator-status {
    min-height: 21px;
    margin-top: 12px;
    font-size: .88rem;
}

.error-text { color: #b42318; }
.success-text { color: #218739; }

.triangle-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 270px;
    padding: 12px;
    border-radius: 10px;
    background: #fff;
    box-shadow: inset 0 0 0 1px #eee7f8;
}

#triangle-visual {
    width: 100%;
    max-height: 230px;
}

.triangle-shape {
    fill: rgba(106, 17, 203, .1);
    stroke: var(--primary);
    stroke-linejoin: round;
    stroke-width: 3;
}

.right-angle {
    fill: none;
    stroke: var(--secondary);
    stroke-width: 3;
}

.svg-label {
    fill: var(--primary);
    font: 700 17px Georgia, serif;
}

.visual-caption {
    margin: 0;
    color: var(--gray);
    font-size: .8rem;
    text-align: center;
}

.calculation-results {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 18px;
}

.metric-card {
    padding: 13px;
    border: 1px solid #e8e0f5;
    border-radius: 9px;
    background: #fff;
}

.metric-card span {
    display: block;
    color: var(--gray);
    font-size: .78rem;
}

.metric-card strong {
    display: block;
    margin-top: 5px;
    color: var(--primary);
    font-size: 1.05rem;
}

.triangle-diagram {
    float: right;
    width: 220px;
    margin: -8px 0 8px 20px;
}

.triangle-diagram svg {
    display: block;
    width: 100%;
    height: auto;
}

.triangle-fill {
    fill: rgba(106, 17, 203, .1);
}

.triangle-line {
    fill: none;
    stroke: var(--primary);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
}

.triangle-diagram text {
    fill: var(--primary);
    font: 700 18px Georgia, serif;
}

button:focus-visible,
input:focus-visible {
    outline: 3px solid #ffb703;
    outline-offset: 3px;
}

button:disabled {
    cursor: wait;
    opacity: .7;
    transform: none;
}

.results-container {
    overflow-x: auto;
}

td.number-cell {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.verification {
    line-height: 1.45;
    white-space: nowrap;
}

.verification small {
    display: block;
    margin-top: 3px;
    color: #216e39;
    font-size: .78em;
}

.message-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: min(360px, calc(100vw - 40px));
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    animation: slideIn .3s ease, fadeOut .3s ease 2.7s;
}

.message-alert.error { background: #b42318; }
.message-alert.warning { color: #332400; background: #ffc107; }
.message-alert.info { background: #087f8c; }
.message-alert.success { background: #218739; }

@media (max-width: 576px) {
    .formula {
        margin-top: 14px;
        font-size: 1.15rem;
    }

    .triangle-diagram {
        float: none;
        width: min(220px, 100%);
        margin: 0 auto 12px;
    }

    .results-container {
        padding: 8px;
    }

    table {
        min-width: 480px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 700px) {
    .main-nav {
        overflow-x: auto;
    }

    .nav-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .section-heading {
        flex-direction: column;
        gap: 10px;
    }

    .calculator-layout {
        grid-template-columns: 1fr;
    }

    .calculation-results {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .calculator-section {
        padding: 16px;
    }

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

    .triangle-card {
        min-height: 220px;
    }
}
