/* =====================================================
   UNIT CONVERTER STYLES
   Basic Calculator Online - Unit Converter
   ===================================================== */

/* ======================= SECTION ======================= */
.unit-converter-section {
    padding: 2rem 0 4rem;
    min-height: 60vh;
}

/* ======================= CATEGORIES SIDEBAR ======================= */
.unit-categories-card {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: sticky;
    top: 100px;
}

.unit-categories-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border-color);
}

.unit-categories-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.unit-categories-list {
    padding: 0.75rem;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.unit-category-btn {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 0.875rem;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    margin-bottom: 0.375rem;
}

.unit-category-btn:last-child {
    margin-bottom: 0;
}

.unit-category-btn:hover {
    background: var(--bg-body);
}

.unit-category-btn.active {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: #ef4444;
}

.category-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

/* Category Colors */
.category-icon.length { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.category-icon.weight { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.category-icon.temperature { background: rgba(249, 115, 22, 0.1); color: #f97316; }
.category-icon.area { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.category-icon.volume { background: rgba(6, 182, 212, 0.1); color: #06b6d4; }
.category-icon.speed { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.category-icon.time { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.category-icon.data { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.category-icon.pressure { background: rgba(20, 184, 166, 0.1); color: #14b8a6; }
.category-icon.energy { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.category-info {
    flex: 1;
    min-width: 0;
}

.category-name {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.category-units {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ======================= MAIN CONVERTER CARD ======================= */
.unit-converter-card {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.unit-converter-card:hover {
    box-shadow: var(--shadow-2xl);
    transform: translateY(-4px);
}

/* Header */
.unit-converter-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    transition: background var(--transition-normal);
}

.unit-converter-header.length { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.unit-converter-header.weight { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); }
.unit-converter-header.temperature { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.unit-converter-header.area { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.unit-converter-header.volume { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }
.unit-converter-header.speed { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
.unit-converter-header.time { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); }
.unit-converter-header.data { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.unit-converter-header.pressure { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%); }
.unit-converter-header.energy { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }

.converter-icon {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.converter-title h3 {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.converter-title p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    margin: 0.25rem 0 0;
}

/* Body */
.unit-converter-body {
    padding: 1.5rem;
}

.unit-input-section {
    margin-bottom: 0.5rem;
}

.unit-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.unit-input-group {
    display: flex;
    gap: 0.75rem;
}

.unit-input {
    flex: 1;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    background: white;
    transition: all var(--transition-fast);
    min-width: 0;
}

.unit-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.unit-input.result {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #86efac;
    color: #166534;
}

.unit-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 1rem;
}

/* Remove number input spinners */
.unit-input::-webkit-outer-spin-button,
.unit-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.unit-input[type=number] {
    -moz-appearance: textfield;
}

/* Select Wrapper */
.unit-select-wrapper {
    position: relative;
    min-width: 140px;
}

.unit-select {
    width: 100%;
    padding: 1rem 2.5rem 1rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    background: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
}

.unit-select:focus {
    outline: none;
    border-color: var(--primary);
}

.unit-select-wrapper i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Swap Button */
.unit-swap-container {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0;
}

.unit-swap-btn {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: white;
    color: var(--primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.unit-swap-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: rotate(180deg);
}

/* Formula Display */
.unit-formula {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    background: var(--bg-body);
    border-radius: var(--radius-lg);
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.unit-formula i {
    color: var(--primary);
}

/* Quick Values */
.unit-quick-values {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.quick-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
}

.quick-value-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: white;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-value-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.quick-value-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Footer */
.unit-converter-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--bg-body);
    border-top: 1px solid var(--border-color);
}

.unit-copy-btn,
.unit-clear-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: white;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.unit-copy-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.unit-clear-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.unit-copy-btn.copied {
    border-color: #22c55e;
    background: #22c55e;
    color: white;
}

/* ======================= RIGHT SIDEBAR ======================= */
.unit-sidebar-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.unit-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
}

.unit-sidebar-header h5 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.unit-clear-history-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.unit-clear-history-btn:hover {
    background: #fef2f2;
    color: #ef4444;
}

.unit-sidebar-body {
    padding: 0.75rem;
    max-height: 280px;
    overflow-y: auto;
}

/* All Conversions List */
.unit-conversion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.unit-conversion-item:hover {
    background: var(--bg-body);
}

.unit-conversion-item .unit-name {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.unit-conversion-item .unit-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* History List */
.unit-history-list {
    max-height: 240px;
}

.unit-history-item {
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 0.5rem;
}

.unit-history-item:hover {
    background: var(--bg-body);
}

.unit-history-item:last-child {
    margin-bottom: 0;
}

.history-category {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.history-conversion {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.history-conversion strong {
    color: #ef4444;
}

/* Empty State */
.unit-empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.unit-empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.unit-empty-state p {
    margin: 0;
    font-size: 0.875rem;
}

/* ======================= COMMON CONVERSIONS SECTION ======================= */
.unit-common-section {
    padding: 4rem 0;
    background: var(--bg-body);
}

.unit-section-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.section-desc {
    font-size: 1.0625rem;
    color: var(--text-muted);
    margin: 0;
}

.unit-common-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    height: 100%;
    transition: all var(--transition-normal);
}

.unit-common-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.common-card-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
}

.common-card-header.length { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.common-card-header.weight { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); }
.common-card-header.temperature { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.common-card-header.volume { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }

.common-card-header i {
    font-size: 1.25rem;
}

.common-card-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.common-card-body {
    padding: 0.75rem;
}

.common-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.common-item:hover {
    background: var(--bg-body);
}

.common-item span:first-child {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.common-item span:nth-child(2) {
    color: var(--text-muted);
}

.common-item span:last-child {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ======================= FEATURES SECTION ======================= */
.unit-features-section {
    padding: 4rem 0 5rem;
}

.unit-feature-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    height: 100%;
    transition: all var(--transition-normal);
}

.unit-feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.unit-feature-card .feature-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #ef4444;
}

.unit-feature-card h5 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.unit-feature-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* ======================= RESPONSIVE ======================= */
@media (max-width: 1199.98px) {
    .unit-categories-card {
        position: static;
    }

    .unit-categories-list {
        max-height: none;
    }
}

@media (max-width: 991.98px) {
    .unit-converter-section {
        padding: 1.5rem 0 3rem;
    }

    .unit-categories-list {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0.5rem;
    }

    .unit-category-btn {
        flex-direction: column;
        text-align: center;
        padding: 0.75rem 0.5rem;
        margin-bottom: 0;
    }

    .category-info {
        display: none;
    }

    .category-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .unit-input {
        font-size: 1.25rem;
        padding: 0.875rem 1rem;
    }

    .unit-select-wrapper {
        min-width: 120px;
    }

    .unit-select {
        padding: 0.875rem 2rem 0.875rem 0.75rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 767.98px) {
    .unit-categories-list {
        grid-template-columns: repeat(5, 1fr);
    }

    .unit-input-group {
        flex-direction: column;
    }

    .unit-select-wrapper {
        width: 100%;
    }

    .unit-input {
        font-size: 1.5rem;
    }

    .unit-converter-footer {
        flex-direction: column;
    }

    .unit-common-section,
    .unit-features-section {
        padding: 3rem 0;
    }

    .section-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .unit-categories-list {
        grid-template-columns: repeat(5, 1fr);
    }

    .category-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9375rem;
    }

    .unit-converter-header {
        flex-direction: column;
        text-align: center;
    }

    .converter-title h3 {
        font-size: 1.125rem;
    }

    .unit-quick-values {
        justify-content: center;
    }
}

/* ======================= SCROLLBARS ======================= */
.unit-categories-list::-webkit-scrollbar,
.unit-sidebar-body::-webkit-scrollbar {
    width: 6px;
}

.unit-categories-list::-webkit-scrollbar-track,
.unit-sidebar-body::-webkit-scrollbar-track {
    background: var(--bg-body);
    border-radius: 3px;
}

.unit-categories-list::-webkit-scrollbar-thumb,
.unit-sidebar-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.unit-categories-list::-webkit-scrollbar-thumb:hover,
.unit-sidebar-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ======================= ANIMATIONS ======================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.unit-converter-body {
    animation: fadeIn 0.3s ease;
}

/* Toast Notification */
.unit-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 0.875rem 1.5rem;
    background: #1f2937;
    color: white;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 500;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.unit-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}