/* ================================
   TOOLS PAGE
================================ */

.tools-page {
    padding: 60px 0 80px;
    background: #fff;
    min-height: 70vh;
}

.tools-hero {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 50px;
}

.tools-badge {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 30px;
    background: #f3f4f6;
    color: #555;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 14px;
}

.tools-hero h1 {
    margin: 0 0 15px;
    font-size: 42px;
    line-height: 1.2;
    color: #111827;
}

.tools-hero p {
    margin: 0;
    color: #6b7280;
    font-size: 17px;
    line-height: 1.7;
}

/* Tools Grid */

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

.tool-card {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding: 28px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.25s ease;
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: #d1d5db;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.tool-icon {
    width: 56px;
    height: 56px;
    min-width: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #f5f5f5;
    font-size: 27px;
}

.tool-content {
    flex: 1;
}

.tool-content h2 {
    margin: 0 0 9px;
    color: #111827;
    font-size: 19px;
    line-height: 1.4;
}

.tool-content p {
    margin: 0 0 16px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.65;
}

.tool-link {
    color: #111827;
    font-size: 14px;
    font-weight: 700;
}

/* Bottom Note */

.tools-note {
    max-width: 760px;
    margin: 55px auto 0;
    padding: 28px;
    text-align: center;
    background: #f7f2f2;
    border-radius: 16px;
}

.tools-note h2 {
    margin: 0 0 8px;
    font-size: 22px;
    color: #111827;
}

.tools-note p {
    margin: 0;
    color: #6b7280;
    line-height: 1.7;
}

/* Responsive */

@media (max-width: 900px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tools-hero h1 {
        font-size: 36px;
    }
}

@media (max-width: 600px) {
    .tools-page {
        padding: 40px 0 60px;
    }

    .tools-hero {
        margin-bottom: 32px;
    }

    .tools-hero h1 {
        font-size: 30px;
    }

    .tools-hero p {
        font-size: 15px;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .tool-card {
        padding: 22px;
    }

    .tools-note {
        margin-top: 35px;
        padding: 22px;
    }
}

/* =================================
   CALCULATOR PAGE
================================= */

.calculator-page {
    padding: 60px 0 80px;
    background: #fff;
    min-height: 70vh;
}

.calculator-header {
    max-width: 750px;
    margin: 0 auto 40px;
    text-align: center;
}

.calculator-badge {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 30px;
    background: #f3f4f6;
    color: #555;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 14px;
}

.calculator-header h1 {
    margin: 0 0 14px;
    font-size: 40px;
    line-height: 1.2;
    color: #111827;
}

.calculator-header p {
    margin: 0;
    color: #6b7280;
    font-size: 16px;
    line-height: 1.7;
}

.calculator-layout {
    max-width: 1050px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
    gap: 28px;
    align-items: start;
}

.calculator-card,
.calculator-info {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    box-sizing: border-box;
    padding: 13px 14px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #fff;
    color: #111827;
    font-size: 15px;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #111827;
}

.calculator-button {
    width: 100%;
    padding: 14px 20px;
    border: 0;
    border-radius: 9px;
    background: #111827;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.calculator-button:hover {
    opacity: 0.9;
}

/* Result */

.calculator-result {
    display: none;
    margin-top: 28px;
    padding: 24px;
    background: #f7f2f2;
    border-radius: 12px;
}

.calculator-result.show {
    display: block;
}

.calculator-result h2 {
    margin: 0 0 18px;
    font-size: 20px;
    color: #111827;
}

.result-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 0;
    border-bottom: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 14px;
}

.result-row strong {
    color: #111827;
}

.result-total {
    border-bottom: 0;
    padding-bottom: 0;
    font-size: 16px;
}

.result-total strong {
    font-size: 20px;
}

/* Information */

.calculator-info h2 {
    margin: 0 0 14px;
    color: #111827;
    font-size: 22px;
}

.calculator-info h3 {
    margin: 25px 0 12px;
    color: #111827;
    font-size: 17px;
}

.calculator-info p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.7;
}

.calculator-info ul {
    margin: 15px 0 0;
    padding-left: 20px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.9;
}

.formula-box {
    padding: 16px;
    border-radius: 10px;
    background: #f3f4f6;
    color: #111827;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
}

/* Mobile */

@media (max-width: 800px) {
    .calculator-layout {
        grid-template-columns: 1fr;
    }

    .calculator-header h1 {
        font-size: 32px;
    }
}

@media (max-width: 600px) {
    .calculator-page {
        padding: 40px 0 60px;
    }

    .calculator-card,
    .calculator-info {
        padding: 22px;
    }

    .calculator-header h1 {
        font-size: 29px;
    }

    .calculator-header p {
        font-size: 15px;
    }

    .result-row {
        flex-direction: column;
        gap: 5px;
    }
}

/* =================================
   CURRENCY CONVERTER
================================= */

.secondary-button {
    margin-bottom: 12px;
    background: #f3f4f6;
    color: #111827;
    border: 1px solid #d1d5db;
}

.secondary-button:hover {
    background: #e5e7eb;
    opacity: 1;
}

.currency-loading {
    display: none;
    margin-top: 20px;
    padding: 14px;
    border-radius: 9px;
    background: #f3f4f6;
    color: #6b7280;
    text-align: center;
    font-size: 14px;
}

.currency-loading.show {
    display: block;
}

.currency-main-result {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.currency-main-result strong {
    color: #111827;
    font-size: 32px;
}

.currency-main-result span {
    color: #6b7280;
    font-size: 18px;
    font-weight: 700;
}

.rate-note {
    margin: 18px 0 0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.6;
}

.currency-error {
    display: none;
    margin-top: 18px;
    padding: 14px;
    border-radius: 9px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 14px;
    line-height: 1.5;
}

.currency-error.show {
    display: block;
}

@media (max-width: 600px) {

    .currency-main-result strong {
        font-size: 27px;
    }

}

/* ================================
   Currency Converter - Large Lists
================================ */

.currency-card {
    width: 100%;
}

.calculator-card select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font-size: 15px;
    outline: none;
}

.calculator-card select:focus {
    border-color: #111827;
}

.calculator-card optgroup {
    font-weight: 700;
    color: #111827;
}

.calculator-card option {
    font-weight: 400;
    color: #111827;
}

.calculator-result {
    display: none;
}

.calculator-result.show {
    display: block;
}

/* ============================================================
   SEARCHABLE CURRENCY DROPDOWN
   ============================================================ */

.currency-select {
    position: relative;
    width: 100%;
}

.currency-select-button {
    width: 100%;
    min-height: 52px;
    padding: 9px 14px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    background: #fff;
    color: #111827;

    cursor: pointer;
    text-align: left;

    font-size: 15px;
}

.currency-select-button:hover {
    border-color: #9ca3af;
}

.currency-select-button:focus {
    outline: none;
    border-color: #111827;
}

.currency-select-button > span:first-child {
    display: flex;
    flex-direction: column;
    gap: 2px;

    min-width: 0;
}

.currency-select-button strong {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

.currency-select-button #fromCurrencyName,
.currency-select-button #toCurrencyName {
    color: #6b7280;
    font-size: 13px;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.currency-arrow {
    flex-shrink: 0;

    color: #6b7280;
    font-size: 18px;
}


/* Dropdown */

.currency-dropdown {
    display: none;

    position: absolute;
    z-index: 100;

    top: calc(100% + 6px);
    left: 0;
    right: 0;

    background: #fff;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.12);

    overflow: hidden;
}

.currency-dropdown.open {
    display: block;
}


/* Search */

.currency-search-wrapper {
    position: relative;

    padding: 10px;

    background: #fff;

    border-bottom: 1px solid #e5e7eb;
}

.currency-search {
    width: 100%;

    min-height: 44px;

    padding: 10px 12px 10px 38px;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    background: #f9fafb;

    color: #111827;

    font-size: 14px;

    outline: none;
}

.currency-search:focus {
    background: #fff;
    border-color: #111827;
}

.currency-search-icon {
    position: absolute;

    left: 22px;
    top: 50%;

    transform: translateY(-50%);

    font-size: 15px;

    pointer-events: none;
}


/* Options area */

.currency-options {
    max-height: 320px;

    overflow-y: auto;

    padding: 5px 0;
}


/* Group title */

.currency-group-title {
    padding: 9px 14px 7px;

    background: #f9fafb;

    color: #6b7280;

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.04em;

    position: sticky;
    top: 0;

    z-index: 2;
}


/* Currency option */

.currency-option {
    width: 100%;

    display: flex;
    align-items: center;
    gap: 10px;

    padding: 10px 14px;

    border: 0;

    background: #fff;

    color: #111827;

    text-align: left;

    cursor: pointer;

    font-size: 14px;
}

.currency-option:hover {
    background: #f3f4f6;
}

.currency-option.selected {
    background: #f3f4f6;
}

.currency-option strong {
    width: 52px;

    flex-shrink: 0;

    color: #111827;

    font-size: 14px;
}

.currency-option span {
    color: #4b5563;

    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;
}


/* No result */

.currency-no-result {
    padding: 20px 14px;

    text-align: center;

    color: #6b7280;

    font-size: 14px;
}


/* Scrollbar */

.currency-options::-webkit-scrollbar {
    width: 7px;
}

.currency-options::-webkit-scrollbar-track {
    background: #f9fafb;
}

.currency-options::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}


/* Mobile */

@media (max-width: 600px) {

    .currency-dropdown {
        position: fixed;

        left: 12px;
        right: 12px;

        top: 50%;

        transform: translateY(-50%);

        max-height: 75vh;
    }

    .currency-options {
        max-height: calc(75vh - 70px);
    }

    .currency-option {
        padding: 12px 14px;
    }

    .currency-search {
        min-height: 46px;
    }

}

/* ============================================================
   CURRENCY DROPDOWN FIX
   ============================================================ */

.currency-select {
    position: relative;
    width: 100%;
    overflow: visible !important;
}

.currency-dropdown {
    display: none !important;

    position: absolute !important;
    z-index: 99999 !important;

    top: calc(100% + 6px) !important;
    left: 0 !important;
    right: 0 !important;

    width: 100% !important;

    background: #ffffff;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);

    overflow: hidden !important;
}

.currency-dropdown.open {
    display: block !important;
}

.currency-options {
    max-height: 320px;
    overflow-y: auto;
}

/* Parent containers must not clip dropdown */

.currency-card,
.calculator-card,
.calculator-layout,
.calculator-section,
.form-group {
    overflow: visible !important;
}

/* ============================================================
   FINAL CURRENCY DROPDOWN
============================================================ */

.currency-select {
    position: relative;
    width: 100%;
    overflow: visible !important;
}

.currency-dropdown {
    display: none !important;

    position: absolute !important;

    top: calc(100% + 6px) !important;
    left: 0 !important;
    right: 0 !important;

    width: 100% !important;

    z-index: 99999 !important;

    background: #ffffff;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);

    overflow: hidden !important;
}

.currency-dropdown.open {
    display: block !important;
}

.currency-options {
    max-height: 320px;
    overflow-y: auto;
}

.currency-card,
.calculator-card,
.calculator-layout,
.calculator-section,
.form-group {
    overflow: visible !important;
}

/* ============================================================
   UNIT CONVERTER
   ============================================================ */

.unit-converter-card {
    overflow: visible !important;
}

.unit-category-select {
    width: 100%;
    min-height: 52px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font-size: 15px;
    cursor: pointer;
    outline: none;
}

.unit-category-select:focus {
    border-color: #111827;
}


/* ============================================================
   UNIT SELECT
   ============================================================ */

.unit-select {
    position: relative;
    width: 100%;
    overflow: visible !important;
}

.unit-select-button {
    width: 100%;
    min-height: 52px;
    padding: 9px 14px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    background: #fff;
    color: #111827;

    cursor: pointer;
    text-align: left;

    font-size: 15px;
}

.unit-select-button:hover {
    border-color: #9ca3af;
}

.unit-select-button:focus {
    outline: none;
    border-color: #111827;
}

.unit-select-button > span:first-child {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.unit-select-button strong {
    font-size: 15px;
    font-weight: 600;
}

.unit-select-button small {
    color: #6b7280;
    font-size: 13px;
}

.unit-arrow {
    font-size: 18px;
    color: #6b7280;
}


/* ============================================================
   UNIT DROPDOWN
   ============================================================ */

.unit-dropdown {
    display: none !important;

    position: absolute !important;

    top: calc(100% + 6px) !important;
    left: 0 !important;
    right: 0 !important;

    width: 100% !important;

    z-index: 99999 !important;

    background: #fff;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.15);

    overflow: hidden !important;
}

.unit-dropdown.open {
    display: block !important;
}


/* ============================================================
   SEARCH
   ============================================================ */

.unit-search-wrapper {
    position: relative;
    padding: 10px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.unit-search {
    width: 100%;
    min-height: 44px;

    padding: 10px 40px 10px 12px;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    background: #fff;
    color: #111827;

    font-size: 14px;

    outline: none;
}

.unit-search:focus {
    border-color: #111827;
}

.unit-search::placeholder {
    color: #9ca3af;
}


/* ============================================================
   CLEAR SEARCH
   ============================================================ */

.unit-search-clear {
    position: absolute;

    right: 17px;
    top: 50%;

    transform: translateY(-50%);

    width: 26px;
    height: 26px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 50%;

    background: transparent;
    color: #6b7280;

    font-size: 20px;
    line-height: 1;

    cursor: pointer;
}

.unit-search-clear:hover {
    background: #f3f4f6;
    color: #111827;
}


/* ============================================================
   OPTIONS
   ============================================================ */

.unit-options {
    max-height: 320px;
    overflow-y: auto;
    padding: 4px;
}

.unit-option {
    width: 100%;

    min-height: 48px;

    padding: 9px 12px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border: 0;
    border-radius: 7px;

    background: transparent;
    color: #111827;

    cursor: pointer;

    text-align: left;
}

.unit-option:hover,
.unit-option.active {
    background: #f3f4f6;
}

.unit-option.selected {
    background: #f3f4f6;
}

.unit-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.unit-option-text strong {
    font-size: 14px;
    font-weight: 500;
}

.unit-option-text small {
    color: #6b7280;
    font-size: 12px;
}

.unit-option-check {
    opacity: 0;

    font-size: 16px;
    font-weight: 700;

    color: #111827;
}

.unit-option.selected .unit-option-check {
    opacity: 1;
}


/* ============================================================
   NO RESULTS
   ============================================================ */

.unit-no-results {
    padding: 22px 14px;

    text-align: center;

    color: #6b7280;

    font-size: 14px;
}


/* ============================================================
   RESULT
   ============================================================ */

.unit-result {
    margin-top: 20px;
}

.unit-main-result {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;

    margin-bottom: 20px;

    text-align: center;
}

.unit-main-result strong {
    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;

    word-break: break-word;
}

.unit-main-result span {
    font-size: 18px;
    color: #6b7280;
}


/* ============================================================
   ERROR
   ============================================================ */

.unit-error {
    display: none;

    margin-top: 14px;
    margin-bottom: 14px;

    padding: 12px 14px;

    border: 1px solid #fecaca;
    border-radius: 8px;

    background: #fef2f2;
    color: #b91c1c;

    font-size: 14px;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 600px) {

    .unit-dropdown {
        position: fixed !important;

        left: 12px !important;
        right: 12px !important;

        top: 50% !important;

        width: auto !important;

        transform: translateY(-50%) !important;

        max-height: 75vh;

        z-index: 999999 !important;
    }

    .unit-options {
        max-height: calc(75vh - 70px);
    }

    .unit-option {
        min-height: 50px;
        padding: 11px 14px;
    }

    .unit-search {
        min-height: 46px;
    }

    .unit-main-result strong {
        font-size: 28px;
    }

}