/* ================================================
   KALKULATOR AI PRO™ — PAPIC OS
   Quantum Neural Compute Engine Interface
   ================================================ */

/* -------- Page Shell -------- */
.kalp-main {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 16px 64px;
}

/* -------- Hero -------- */
.kalp-hero {
    padding: 40px 0 32px;
}

.kalp-hero-copy {
    max-width: 560px;
}

.kalp-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #00827B;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.kalp-eyebrow i {
    font-size: 14px;
}

.kalp-hero h1 {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 800;
    line-height: 1.1;
    color: #111216;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.kalp-hero h1 span {
    color: #00827B;
}

.kalp-hero-desc {
    font-size: 15px;
    color: #555961;
    line-height: 1.6;
    max-width: 480px;
}

.kalp-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.kalp-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f0faf9;
    color: #00827B;
    border: 1px solid rgba(0, 130, 123, 0.15);
}

.kalp-badge--purple {
    background: #f3f0ff;
    color: #6658FF;
    border-color: rgba(102, 88, 255, 0.15);
}

.kalp-badge--amber {
    background: #fff8eb;
    color: #b8860b;
    border-color: rgba(247, 183, 15, 0.2);
}

/* -------- Calculator Container -------- */
.kalp-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.kalp-container > * {
    min-width: 0;
}

/* -------- Calculator Card -------- */
.kalp-card {
    background: #ffffff;
    border: 1px solid #E8EAEE;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(17, 18, 22, 0.05);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.kalp-card-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f8fafb;
    border-bottom: 1px solid #E8EAEE;
}

.kalp-card-dots {
    display: flex;
    gap: 6px;
}

.kalp-card-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.kalp-card-dot--red { background: #ff5f57; }
.kalp-card-dot--yellow { background: #febc2e; }
.kalp-card-dot--green { background: #28c840; }

.kalp-card-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: #8B9098;
    text-transform: uppercase;
}

.kalp-card-clock {
    font-size: 11px;
    font-weight: 600;
    color: #8B9098;
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
}

/* -------- Display -------- */
.kalp-display {
    background: #111216;
    padding: 24px 20px 20px;
    position: relative;
    overflow: hidden;
    min-height: 120px;
}

.kalp-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(180deg, rgba(0, 130, 123, 0.06) 0%, transparent 100%);
    pointer-events: none;
}

.kalp-display-expr {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.5px;
    min-height: 20px;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'DM Mono', 'JetBrains Mono', monospace;
}

.kalp-display-value {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: clamp(32px, 8vw, 52px);
    font-weight: 800;
    color: #ffffff;
    text-align: right;
    line-height: 1.1;
    letter-spacing: -1px;
    word-break: break-all;
    transition: color 0.3s ease;
    position: relative;
}

.kalp-display-value.is-loading {
    color: #F7B70F;
}

.kalp-display-value.is-error {
    color: #ff5f57;
}

.kalp-display-value.is-done {
    color: #28c840;
}

.kalp-cursor {
    display: inline-block;
    width: 3px;
    height: 0.8em;
    background: #00827B;
    margin-left: 4px;
    vertical-align: middle;
    animation: kalpBlink 0.9s step-end infinite;
}

@keyframes kalpBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* -------- Process Panel -------- */
.kalp-process {
    background: #0d0f11;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 16px 20px 20px;
    display: none;
    flex-direction: column;
    gap: 6px;
}

.kalp-process.is-visible {
    display: flex;
}

.kalp-process-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.kalp-process-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
}

.kalp-process-timer {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #00827B;
    font-variant-numeric: tabular-nums;
    font-family: 'DM Mono', monospace;
}

.kalp-process-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.kalp-process-list::-webkit-scrollbar {
    width: 4px;
}

.kalp-process-list::-webkit-scrollbar-track {
    background: transparent;
}

.kalp-process-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.kalp-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.kalp-step.is-show {
    opacity: 1;
    transform: translateY(0);
}

.kalp-step.is-active {
    background: rgba(0, 130, 123, 0.08);
}

.kalp-step-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    border-radius: 4px;
}

.kalp-step-icon.is-waiting {
    color: rgba(255, 255, 255, 0.2);
}

.kalp-step-icon.is-running {
    color: #F7B70F;
    animation: kalpSpin 0.7s linear infinite;
}

.kalp-step-icon.is-done {
    color: #28c840;
}

.kalp-step-icon.is-fail {
    color: #ff5f57;
}

@keyframes kalpSpin {
    to { transform: rotate(360deg); }
}

.kalp-step-label {
    flex: 1;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 500;
    transition: color 0.2s ease;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}

.kalp-step-label.is-running {
    color: #F7B70F;
}

.kalp-step-label.is-done {
    color: rgba(255, 255, 255, 0.7);
}

.kalp-step-label.is-fail {
    color: #ff5f57;
}

.kalp-step-status {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.kalp-step-status.is-running {
    color: #F7B70F;
}

.kalp-step-status.is-done {
    color: #28c840;
}

.kalp-step-status.is-fail {
    color: #ff5f57;
}

/* Progress Bar */
.kalp-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    margin-top: 12px;
    border-radius: 3px;
    overflow: hidden;
}

.kalp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00827B, #00a89e);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 3px;
    position: relative;
}

.kalp-progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: -1px;
    width: 20px;
    height: 5px;
    background: rgba(0, 168, 158, 0.6);
    filter: blur(4px);
    border-radius: 50%;
}

/* -------- Network Log -------- */
.kalp-netlog {
    background: #08090b;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    display: none;
}

.kalp-netlog.is-visible {
    display: block;
}

.kalp-netlog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(0, 130, 123, 0.06);
    border-bottom: 1px solid rgba(0, 130, 123, 0.1);
}

.kalp-netlog-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kalp-netlog-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00827B;
    box-shadow: 0 0 6px rgba(0, 130, 123, 0.5);
    animation: kalpNetPulse 1.2s ease infinite;
}

@keyframes kalpNetPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.kalp-netlog-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #00827B;
    text-transform: uppercase;
}

.kalp-netlog-counter {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.25);
    font-variant-numeric: tabular-nums;
    font-family: 'DM Mono', monospace;
}

.kalp-netlog-list {
    display: block;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 20px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.kalp-netlog-list::-webkit-scrollbar {
    width: 4px;
}

.kalp-netlog-list::-webkit-scrollbar-track {
    background: transparent;
}

.kalp-netlog-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.kalp-netlog-item {
    font-size: 11px;
    font-family: 'DM Mono', 'JetBrains Mono', monospace;
    color: rgba(255, 255, 255, 0.3);
    height: 24px;
    line-height: 24px;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.kalp-netlog-item.is-show {
    opacity: 1;
}

.kalp-netlog-item .net-method {
    display: inline-block;
    min-width: 52px;
    color: #00827B;
    font-weight: 700;
}

.kalp-netlog-item .net-path {
    color: rgba(255, 255, 255, 0.4);
}

.kalp-netlog-item .net-status {
    color: #28c840;
    font-weight: 600;
}

.kalp-netlog-item .net-status.is-pending {
    color: #F7B70F;
}

.kalp-netlog-item .net-time {
    color: rgba(255, 255, 255, 0.15);
}

.kalp-netlog-item .net-latency {
    color: rgba(255, 255, 255, 0.2);
    font-size: 10px;
}

/* -------- Buttons -------- */
.kalp-buttons {
    padding: 14px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.kalp-btn {
    height: 58px;
    border: 1px solid #E8EAEE;
    background: #ffffff;
    color: #111216;
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.kalp-btn:hover {
    background: #f8fafb;
    border-color: #d0d2d6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(17, 18, 22, 0.06);
}

.kalp-btn:active {
    transform: scale(0.95);
    box-shadow: none;
}

.kalp-btn.is-pressed {
    background: #f0f0f2;
    transform: scale(0.93);
}

.kalp-btn--op {
    color: #00827B;
    font-size: 22px;
    font-weight: 700;
    background: #f0faf9;
    border-color: rgba(0, 130, 123, 0.12);
}

.kalp-btn--op:hover {
    background: #e0f5f3;
    border-color: rgba(0, 130, 123, 0.25);
}

.kalp-btn--clear {
    color: #ff5f57;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    background: #fff5f5;
    border-color: rgba(255, 95, 87, 0.12);
}

.kalp-btn--clear:hover {
    background: #ffe8e7;
    border-color: rgba(255, 95, 87, 0.25);
}

.kalp-btn--equals {
    background: #00827B;
    border-color: #00827B;
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
    box-shadow: 0 4px 16px rgba(0, 130, 123, 0.2);
}

.kalp-btn--equals:hover {
    background: #006e68;
    box-shadow: 0 6px 20px rgba(0, 130, 123, 0.3);
}

.kalp-btn--equals:active {
    background: #005a55;
}

.kalp-btn--equals:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.kalp-btn--span2 {
    grid-column: span 2;
}

/* -------- Status Bar -------- */
.kalp-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid #E8EAEE;
    background: #f8fafb;
}

.kalp-status-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kalp-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #28c840;
    box-shadow: 0 0 6px rgba(40, 200, 64, 0.4);
    animation: kalpPulse 2s ease infinite;
}

@keyframes kalpPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}

.kalp-status-text {
    font-size: 11px;
    font-weight: 600;
    color: #8B9098;
    letter-spacing: 0.5px;
}

.kalp-status-right {
    font-size: 11px;
    font-weight: 600;
    color: #8B9098;
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
}

/* -------- Side Panel -------- */
.kalp-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kalp-side-card {
    background: #ffffff;
    border: 1px solid #E8EAEE;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 12px 32px rgba(17, 18, 22, 0.05);
}

.kalp-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.kalp-side-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kalp-clear-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid #E8EAEE;
    background: #ffffff;
    color: #8B9098;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.kalp-clear-btn:hover {
    background: #fff5f5;
    border-color: rgba(255, 95, 87, 0.3);
    color: #ff5f57;
}

.kalp-side-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #8B9098;
    text-transform: uppercase;
}

.kalp-side-title {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: #111216;
    margin-top: 2px;
}

.kalp-side-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.kalp-side-icon--cyan {
    background: rgba(0, 130, 123, 0.1);
    color: #00827B;
}

.kalp-side-icon--purple {
    background: rgba(102, 88, 255, 0.1);
    color: #6658FF;
}

.kalp-side-icon--amber {
    background: rgba(247, 183, 15, 0.1);
    color: #b8860b;
}

/* Session History */
.kalp-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.kalp-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f8fafb;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.kalp-history-item:hover {
    background: #f0f2f4;
}

.kalp-history-expr {
    color: #555961;
    font-weight: 500;
}

.kalp-history-result {
    color: #00827B;
    font-weight: 700;
}

.kalp-history-empty {
    font-size: 13px;
    color: #8B9098;
    text-align: center;
    padding: 20px 0;
}

/* Stats */
.kalp-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.kalp-stat {
    padding: 12px;
    border-radius: 10px;
    background: #f8fafb;
    text-align: center;
}

.kalp-stat-value {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: #111216;
    line-height: 1.2;
}

.kalp-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: #8B9098;
    margin-top: 2px;
}

/* Sysinfo */
.kalp-sysinfo {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kalp-sysinfo-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.kalp-sysinfo-key {
    color: #8B9098;
    font-weight: 500;
}

.kalp-sysinfo-val {
    color: #111216;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.kalp-sysinfo-val--green {
    color: #16823A;
}

/* -------- Warning Footer -------- */
.kalp-warning {
    margin-top: 24px;
    padding: 16px 20px;
    background: #fff8eb;
    border: 1px solid rgba(247, 183, 15, 0.2);
    border-radius: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.kalp-warning-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(247, 183, 15, 0.15);
    color: #b8860b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.kalp-warning-text {
    font-size: 12px;
    color: #7a6a2e;
    line-height: 1.6;
}

.kalp-warning-text strong {
    color: #5c4e10;
}

/* -------- Toast -------- */
.kalp-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #111216;
    color: #ffffff;
    padding: 12px 24px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kalp-toast.is-show {
    transform: translateX(-50%) translateY(0);
}

.kalp-toast-icon {
    font-size: 14px;
}

.kalp-toast-icon--success {
    color: #28c840;
}

.kalp-toast-icon--warn {
    color: #F7B70F;
}

.kalp-toast-icon--error {
    color: #ff5f57;
}

/* -------- Keyboard Hint -------- */
.kalp-kb-hint {
    text-align: center;
    margin-top: 12px;
    font-size: 12px;
    color: #8B9098;
}

.kalp-kb-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-family: 'DM Mono', monospace;
    background: #f0f2f4;
    border: 1px solid #E8EAEE;
    border-radius: 4px;
    color: #555961;
    margin: 0 2px;
}

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

@media (min-width: 768px) {
    .kalp-main {
        padding: 0 24px 64px;
    }

    .kalp-container {
        grid-template-columns: 1fr 300px;
    }

    .kalp-btn {
        height: 62px;
    }
}

@media (min-width: 1024px) {
    .kalp-main {
        padding: 0 32px 80px;
    }

    .kalp-container {
        grid-template-columns: 1fr 320px;
    }
}

@media (max-width: 767px) {
    .kalp-hero {
        padding: 28px 0 20px;
    }

    .kalp-hero h1 {
        font-size: 26px;
    }

    .kalp-btn {
        height: 52px;
        font-size: 16px;
        border-radius: 8px;
    }

    .kalp-btn--op {
        font-size: 20px;
    }

    .kalp-btn--equals {
        font-size: 22px;
    }

    .kalp-buttons {
        gap: 6px;
        padding: 12px;
    }

    .kalp-side {
        margin-top: 4px;
    }

    .kalp-warning {
        margin-top: 16px;
    }
}

@media (max-width: 400px) {
    .kalp-btn {
        height: 48px;
        font-size: 15px;
    }

    .kalp-btn--clear {
        font-size: 11px;
    }
}
