/* ==========================================================
   ToolXone Calculator Components
   Version: 2.0.0
   Shared Calculator Component Library

   RESPONSIBILITY:
   - Calculator UI components only
   - No page layout
   - No related tools
   - No hero layout
   - No legacy calculator selectors
   ========================================================== */


/* ==========================================================
   1. CALCULATOR CARD
   ========================================================== */

.tx-calculator-card {

    display: flex;
    flex-direction: column;

    width: 100%;

    gap: 20px;

    padding: 32px;

    box-sizing: border-box;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 24px;

    box-shadow:
        0 12px 35px rgba(15, 23, 42, 0.10),
        0 2px 8px rgba(15, 23, 42, 0.04);

    transition:
        box-shadow .25s ease,
        border-color .25s ease,
        background-color .25s ease;
}


/* ==========================================================
   2. CALCULATOR HEADER
   ========================================================== */

.tx-calculator-header {

    display: flex;

    flex-direction: column;

    align-items: center;

    gap: 10px;

    text-align: center;

}


.tx-calculator-title {

    margin: 0;

    font-size: 1.75rem;

    line-height: 1.25;

    font-weight: 800;

    color: #0f172a;
}


.tx-calculator-subtitle {

    margin: 0;

    max-width: 680px;

    font-size: .95rem;

    line-height: 1.65;

    color: #64748b;
}


/* ==========================================================
   3. CALCULATOR DISPLAY
   ========================================================== */

.tx-calculator-display {

    display: flex;

    flex-direction: column;

    width: 100%;

    gap: 10px;

}


.tx-calculator-display input,

.tx-calculator-display textarea,

.tx-display-input {

    width: 100%;

    min-height: 68px;

    padding: 16px 18px;

    box-sizing: border-box;

    border: 2px solid #dbe4ee;

    border-radius: 16px;

    background: #ffffff;

    color: #111827;

    font-size: 1.75rem;

    font-weight: 700;

    line-height: 1.3;

    text-align: right;

    outline: none;

    transition:
        border-color .25s ease,
        box-shadow .25s ease,
        background-color .25s ease;
}


.tx-calculator-display input:focus,

.tx-calculator-display textarea:focus,

.tx-display-input:focus {

    border-color: #10b981;

    box-shadow:
        0 0 0 4px rgba(16, 185, 129, .12);
}


/* ==========================================================
   4. NUMBER IN WORDS / DISPLAY HELPER
   ========================================================== */

.tx-number-words,

.tx-calculator-number-words,

.tx-display-helper {

    min-height: 24px;

    padding: 8px 12px;

    box-sizing: border-box;

    border: 1px solid #dce7e3;

    border-radius: 10px;

    background: #f7fbf9;

    color: #14532d;

    font-size: .78rem;

    font-weight: 600;

    line-height: 1.45;

    text-align: center;

    overflow-wrap: anywhere;
}


.tx-number-words:empty,

.tx-calculator-number-words:empty,

.tx-display-helper:empty {

    display: none;
}


/* ==========================================================
   5. BUTTON GRID
   ========================================================== */

.tx-button-grid {

    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 12px;

    width: 100%;
}


/* ==========================================================
   6. BASE CALCULATOR BUTTON
   ========================================================== */

.tx-calc-btn {

    display: flex;

    align-items: center;

    justify-content: center;

    min-width: 0;

    min-height: 60px;

    padding: 12px;

    box-sizing: border-box;

    border: 1px solid transparent;

    border-radius: 14px;

    background: #f1f5f9;

    color: #0f172a;

    font-size: 1.05rem;

    font-weight: 700;

    line-height: 1;

    cursor: pointer;

    user-select: none;

    touch-action: manipulation;

    transition:
        transform .18s ease,
        background-color .22s ease,
        border-color .22s ease,
        box-shadow .22s ease,
        color .22s ease,
        opacity .18s ease;
}


/* ==========================================================
   7. NORMAL BUTTON
   ========================================================== */

.tx-calc-btn:hover {

    background: #e8eef5;

    border-color: #d1d9e6;

    transform: translateY(-2px);

    box-shadow:
        0 8px 18px rgba(15, 23, 42, .10);
}


/* ==========================================================
   8. OPERATOR BUTTON
   ========================================================== */

.tx-calc-btn.tx-operator {

    background: #10b981;

    color: #ffffff;

    border-color: #10b981;

    box-shadow:
        0 4px 10px rgba(16, 185, 129, .22);
}


.tx-calc-btn.tx-operator:hover {

    background: #059669;

    border-color: #059669;

    box-shadow:
        0 10px 22px rgba(16, 185, 129, .28);
}


/* ==========================================================
   9. EQUAL BUTTON
   ========================================================== */

.tx-calc-btn.tx-equal {

    background: #2563eb;

    color: #ffffff;

    border-color: #2563eb;

    box-shadow:
        0 4px 10px rgba(37, 99, 235, .22);
}


.tx-calc-btn.tx-equal:hover {

    background: #1d4ed8;

    border-color: #1d4ed8;

    box-shadow:
        0 10px 22px rgba(37, 99, 235, .28);
}


/* ==========================================================
   10. CLEAR BUTTON
   ========================================================== */

.tx-calc-btn.tx-clear {

    background: #ef4444;

    color: #ffffff;

    border-color: #ef4444;

    box-shadow:
        0 4px 10px rgba(239, 68, 68, .22);
}


.tx-calc-btn.tx-clear:hover {

    background: #dc2626;

    border-color: #dc2626;

    box-shadow:
        0 10px 22px rgba(239, 68, 68, .28);
}


/* ==========================================================
   11. WIDE BUTTON
   ========================================================== */

.tx-calc-btn.tx-clear-wide,

.tx-button-wide {

    grid-column: span 4;
}


/* ==========================================================
   12. BUTTON ACTIVE STATE
   ========================================================== */

.tx-calc-btn:active {

    transform: scale(.97);

    box-shadow:
        0 2px 6px rgba(15, 23, 42, .12);
}


/* ==========================================================
   13. BUTTON FOCUS
   ========================================================== */

.tx-calc-btn:focus {

    outline: none;
}


.tx-calc-btn:focus-visible {

    outline:
        3px solid
        rgba(16, 185, 129, .28);

    outline-offset: 3px;
}


/* ==========================================================
   14. DISABLED BUTTON
   ========================================================== */

.tx-calc-btn:disabled {

    opacity: .55;

    cursor: not-allowed;

    transform: none;

    box-shadow: none;
}


/* ==========================================================
   15. RESULT AREA
   ========================================================== */

.tx-result {

    display: flex;

    flex-direction: column;

    gap: 12px;

    width: 100%;
}


.tx-result-row {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 16px;
}


/* ==========================================================
   16. INPUT GROUP
   ========================================================== */

.tx-input-group {

    display: flex;

    flex-direction: column;

    gap: 8px;

    width: 100%;
}


.tx-input-row {

    display: flex;

    gap: 12px;

    width: 100%;
}


.tx-input-row > * {

    flex: 1;

    min-width: 0;
}


/* ==========================================================
   17. ACTION AREA
   ========================================================== */

.tx-actions {

    display: flex;

    flex-wrap: wrap;

    align-items: center;

    justify-content: center;

    gap: 12px;

}


/* ==========================================================
   18. BUTTON GROUP
   ========================================================== */

.tx-button-group {

    display: flex;

    flex-wrap: wrap;

    gap: 12px;
}


.tx-button-block {

    width: 100%;
}


/* ==========================================================
   19. UTILITY COMPONENTS
   ========================================================== */

.tx-full-width {

    width: 100%;
}


.tx-center {

    display: flex;

    align-items: center;

    justify-content: center;
}


.tx-stack {

    display: flex;

    flex-direction: column;

    gap: 16px;
}


/* ==========================================================
   20. LOADING BUTTON
   ========================================================== */

.tx-button-loading {

    pointer-events: none;

    opacity: .75;
}


.tx-button-loading::after {

    content: "";

    width: 16px;

    height: 16px;

    margin-left: 8px;

    border: 2px solid transparent;

    border-top-color: currentColor;

    border-radius: 50%;

    animation:
        tx-button-spin .8s linear infinite;
}


@keyframes tx-button-spin {

    from {

        transform: rotate(0deg);

    }

    to {

        transform: rotate(360deg);

    }

}


/* ==========================================================
   21. DARK MODE
   ========================================================== */

body.dark-mode .tx-calculator-card {

    background: #111827;

    border-color: #2b3648;

    box-shadow:
        0 18px 50px rgba(0, 0, 0, .42);
}


body.dark-mode .tx-calculator-title {

    color: #f8fafc;
}


body.dark-mode .tx-calculator-subtitle {

    color: #94a3b8;
}


body.dark-mode .tx-calculator-display input,

body.dark-mode .tx-calculator-display textarea,

body.dark-mode .tx-display-input {

    background: #0f172a;

    color: #f8fafc;

    border-color: #334155;
}


body.dark-mode .tx-calculator-display input:focus,

body.dark-mode .tx-calculator-display textarea:focus,

body.dark-mode .tx-display-input:focus {

    border-color: #10b981;
}


body.dark-mode .tx-number-words,

body.dark-mode .tx-calculator-number-words,

body.dark-mode .tx-display-helper {

    background: #152032;

    color: #c7f9d4;

    border-color: #2b3648;
}


body.dark-mode .tx-calc-btn {

    background: #374151;

    color: #f8fafc;

    border-color: #4b5563;
}


body.dark-mode .tx-calc-btn:hover {

    background: #4b5563;

    border-color: #64748b;
}


body.dark-mode .tx-calc-btn.tx-operator {

    background: #10b981;

    color: #ffffff;

    border-color: #10b981;
}


body.dark-mode .tx-calc-btn.tx-equal {

    background: #2563eb;

    color: #ffffff;

    border-color: #2563eb;
}


body.dark-mode .tx-calc-btn.tx-clear {

    background: #ef4444;

    color: #ffffff;

    border-color: #ef4444;
}


/* ==========================================================
   22. RESPONSIVE COMPONENTS
   ========================================================== */

@media (max-width: 768px) {

    .tx-calculator-card {

        padding: 24px;

        border-radius: 20px;

    }

    .tx-calculator-title {

        font-size: 1.5rem;

    }

    .tx-calculator-display input,

    .tx-calculator-display textarea,

    .tx-display-input {

        min-height: 62px;

        padding: 14px 16px;

        font-size: 1.5rem;

    }

    .tx-button-grid {

        gap: 10px;

    }

}


@media (max-width: 576px) {

    .tx-calculator-card {

        padding: 20px;

    }

    .tx-calc-btn {

        min-height: 56px;

        border-radius: 12px;

    }

    .tx-button-grid {

        gap: 8px;

    }

}


@media (max-width: 420px) {

    .tx-calculator-card {

        padding: 16px;

        border-radius: 16px;

    }

    .tx-calc-btn {

        min-height: 52px;

        font-size: 1rem;

    }

    .tx-button-grid {

        gap: 7px;

    }

}


/* ==========================================================
   23. REDUCED MOTION
   ========================================================== */

@media (prefers-reduced-motion: reduce) {

    .tx-calculator-card,

    .tx-calc-btn,

    .tx-calculator-display input,

    .tx-calculator-display textarea,

    .tx-display-input {

        transition: none !important;

        animation: none !important;

    }

    .tx-calc-btn:hover,

    .tx-calc-btn:active {

        transform: none;

    }

}


/* ==========================================================
   END — TOOLXONE CALCULATOR COMPONENTS
   ========================================================== */