/* ============================================
   PERCENTAGE CALCULATOR - FIGMA LEVEL CSS
   Version 1.0
============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* Reset */
.pct-wrap * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.pct-wrap {
    --indigo:        #4F46E5;
    --indigo-dark:   #3730A3;
    --indigo-light:  #EEF2FF;
    --orange:        #F59E0B;
    --orange-light:  #FFFBEB;
    --rose:          #F43F5E;
    --rose-light:    #FFF1F2;
    --teal:          #0D9488;
    --teal-light:    #F0FDFA;
    --grad:          linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    --grad-soft:     linear-gradient(135deg,
                     rgba(79,70,229,0.07) 0%,
                     rgba(124,58,237,0.07) 100%);
    --white:         #FFFFFF;
    --bg:            #F5F3FF;
    --border:        rgba(79,70,229,0.14);
    --text:          #1A1A2E;
    --text-muted:    #6B7280;
    --shadow:        0 32px 80px rgba(79,70,229,0.16),
                     0 8px 24px rgba(124,58,237,0.10);
    --shadow-btn:    0 12px 32px rgba(79,70,229,0.40);
    --radius-xl:     24px;
    --radius-lg:     16px;
    --radius-md:     12px;
    --radius-sm:     8px;
    font-family: 'Inter', sans-serif;
    position: relative;
    padding: 40px 16px;
    background: var(--bg);
}

/* Blobs */
.pct-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: 0;
}
.pct-blob-1 {
    width: 300px; height: 300px;
    background: rgba(79,70,229,0.10);
    top: -80px; left: -80px;
}
.pct-blob-2 {
    width: 250px; height: 250px;
    background: rgba(124,58,237,0.09);
    bottom: 20px; right: -60px;
}
.pct-blob-3 {
    width: 180px; height: 180px;
    background: rgba(245,158,11,0.07);
    top: 40%; left: 40%;
}

/* Card */
.pct-card {
    position: relative;
    z-index: 1;
    max-width: 580px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
}

/* Header */
.pct-header {
    background: var(--grad);
    padding: 26px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.pct-header::after {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    top: -80px; right: -50px;
}

.pct-header::before {
    content: '';
    position: absolute;
    width: 120px; height: 120px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    bottom: -40px; left: 30%;
}

.pct-header-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,0.18);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.25);
}

.pct-header-text h2 {
    color: white;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.pct-header-text p {
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    margin-top: 3px;
}

/* Tabs */
.pct-tabs {
    display: flex;
    padding: 16px 32px 0;
    gap: 2px;
    background: white;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.pct-tabs::-webkit-scrollbar {
    display: none;
}

.pct-tab {
    padding: 10px 18px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: 8px 8px 0 0;
    transition: all 0.25s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.pct-tab:hover {
    color: var(--indigo);
    background: rgba(79,70,229,0.04);
}

.pct-tab-active {
    color: var(--indigo) !important;
    border-bottom: 3px solid var(--indigo) !important;
    background: rgba(79,70,229,0.06) !important;
}

/* Body */
.pct-body {
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* Section */
.pct-section {
    flex-direction: column;
    gap: 18px;
}

/* Field Group */
.pct-field-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Step Label */
.pct-step-label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pct-step-num {
    width: 26px; height: 26px;
    background: var(--grad);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(79,70,229,0.35);
}

.pct-step-label span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

/* Input Wrap */
.pct-input-wrap {
    display: flex;
    align-items: stretch;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #FAFAFF;
    transition: all 0.25s ease;
}

.pct-input-wrap:focus-within {
    border-color: var(--indigo);
    background: white;
    box-shadow: 0 0 0 4px rgba(79,70,229,0.08);
}

.pct-input-wrap:hover {
    border-color: rgba(79,70,229,0.30);
}

.pct-input-prefix,
.pct-input-suffix {
    padding: 0 14px;
    font-size: 15px;
    font-weight: 700;
    color: var(--indigo);
    background: rgba(79,70,229,0.06);
    display: flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.pct-input-prefix {
    border-right: 1.5px solid var(--border);
}

.pct-input-suffix {
    border-left: 1.5px solid var(--border);
}

.pct-input-wrap input {
    width: 100%;
    padding: 14px 16px;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    outline: none;
    -moz-appearance: textfield;
}

.pct-input-wrap input::-webkit-inner-spin-button,
.pct-input-wrap input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pct-input-wrap input::placeholder {
    color: #CBD5E1;
    font-weight: 400;
}

/* Calculate Button */
#pct_btn {
    width: 100%;
    padding: 15px 24px;
    background: var(--grad);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-btn);
    position: relative;
    overflow: hidden;
    margin-top: 4px;
}

#pct_btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.15),
        transparent
    );
    opacity: 0;
    transition: opacity 0.3s;
}

#pct_btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(79,70,229,0.45);
}

#pct_btn:hover::before { opacity: 1; }
#pct_btn:active { transform: translateY(0); }

.pct-btn-icon {
    width: 28px; height: 28px;
    background: rgba(255,255,255,0.20);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Result Section */
.pct-result {
    display: none;
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.45s cubic-bezier(0.34,1.56,0.64,1);
    flex-direction: column;
    gap: 14px;
}

.pct-result-visible {
    display: flex !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Result Header */
.pct-result-header {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pct-result-badge {
    background: var(--grad);
    color: white;
    padding: 6px 20px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(79,70,229,0.30);
}

/* Main Result */
.pct-main-result {
    background: var(--grad);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(79,70,229,0.25);
}

.pct-main-result::before {
    content: '';
    position: absolute;
    width: 160px; height: 160px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    top: -60px; right: -40px;
}

.pct-main-result::after {
    content: '';
    position: absolute;
    width: 100px; height: 100px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    bottom: -30px; left: -20px;
}

.pct-main-label {
    color: rgba(255,255,255,0.80);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.pct-main-value {
    color: white;
    font-size: 42px;
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1;
    position: relative;
    z-index: 1;
}

/* Breakdown Grid */
.pct-breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.pct-breakdown-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    transition: all 0.25s ease;
}

.pct-breakdown-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79,70,229,0.10);
}

/* Card Colors */
.pct-card-1 { background: var(--indigo-light); }
.pct-card-2 { background: var(--orange-light); }
.pct-card-3 { background: var(--teal-light); }
.pct-card-4 { background: #FAFAFF; }

.pct-breakdown-icon {
    font-size: 22px;
    width: 40px; height: 40px;
    background: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pct-breakdown-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.pct-breakdown-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.pct-formula {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--indigo) !important;
    word-break: break-all;
    line-height: 1.5 !important;
}

/* Footer */
.pct-footer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 16px 32px 24px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    border-top: 1px solid var(--border);
    background: #FAFAFF;
}

.pct-footer svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--indigo);
}

/* Mobile */
@media (max-width: 600px) {
    .pct-wrap {
        padding: 20px 10px;
    }
    .pct-card {
        border-radius: var(--radius-lg);
    }
    .pct-header {
        padding: 22px 20px;
    }
    .pct-body {
        padding: 22px 20px;
    }
    .pct-tabs {
        padding: 14px 20px 0;
    }
    .pct-footer {
        padding: 14px 20px 20px;
    }
    .pct-main-value {
        font-size: 34px;
    }
    .pct-breakdown-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .pct-tab {
        padding: 8px 14px;
        font-size: 12px;
    }
}

@media (max-width: 400px) {
    .pct-breakdown-grid {
        grid-template-columns: 1fr;
    }
    .pct-main-value {
        font-size: 28px;
    }
    .pct-header-text h2 {
        font-size: 18px;
    }
}
