/* ========================================
   UNIT CONVERTER SPECIFIC STYLES
   Extends styles.css with converter-specific design
======================================== */

/* ========================================
   CONVERTER CONTAINER
======================================== */
.converter-container {
    width: 100%;
    max-width: 520px;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: visible;
    transition: max-width var(--transition-normal);
}

/* ========================================
   CATEGORY SELECTOR
======================================== */
.category-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap-xs);
    padding: var(--gap-md);
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.category-btn {
    padding: 0.65rem 0.5rem;
    border: none;
    background: white;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    touch-action: manipulation; /* Prevents double-tap zoom */
}

.category-btn:hover {
    background: var(--btn-hover);
    transform: translateY(-1px);
}

.category-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

/* ========================================
   CONVERTER INTERFACE
======================================== */
.converter-interface {
    padding: var(--gap-md);
}

.converter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--gap-md);
    padding-bottom: var(--gap-sm);
    border-bottom: 2px solid #f1f5f9;
}

.converter-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.swap-btn {
    background: var(--operator-bg);
    color: var(--primary-color);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation; /* Prevents double-tap zoom */
}

.swap-btn:hover {
    background: var(--operator-hover);
    transform: rotate(180deg);
    box-shadow: var(--shadow-md);
}

.swap-btn:active {
    transform: rotate(180deg) scale(0.95);
}

/* ========================================
   CONVERSION SECTIONS
======================================== */
.conversion-section {
    margin-bottom: var(--gap-md);
}

.conversion-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: var(--gap-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.conversion-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-sm);
}

.conversion-input {
    padding: 0.875rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
    background: white;
    transition: all var(--transition-fast);
}

.conversion-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.conversion-input:read-only {
    background: #f8fafc;
    color: var(--primary-color);
    font-weight: 600;
}

.unit-select {
    padding: 0.875rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    background: white;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.unit-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.unit-select:hover {
    border-color: #cbd5e1;
}

/* ========================================
   QUICK INFO
======================================== */
.quick-info {
    background: linear-gradient(135deg, #f0fdf4 0%, #fef3c7 100%);
    padding: var(--gap-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--gap-md);
    border: 2px solid #d1fae5;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: var(--gap-xs);
}

.info-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #166534;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: 0.8125rem;
    color: #475569;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

/* ========================================
   COMMON CONVERSIONS
======================================== */
.common-conversions {
    background: #f8fafc;
    padding: var(--gap-md);
    border-radius: var(--radius-lg);
    border: 2px solid #e2e8f0;
}

.common-conversions h3 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 0 0 var(--gap-sm) 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.conversions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap-xs);
}

.conversion-item {
    background: white;
    padding: var(--gap-sm);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1px solid transparent;
}

.conversion-item:hover {
    background: var(--btn-hover);
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.conversion-from {
    color: var(--secondary-color);
    font-weight: 500;
}

.conversion-equals {
    color: #94a3b8;
    margin: 0 var(--gap-xs);
}

.conversion-to {
    color: var(--primary-color);
    font-weight: 600;
}

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

/* Mobile phones (up to 575px) */
@media (max-width: 575px) {
    .converter-container {
        max-width: 100%;
    }

    .conversion-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.375rem;
    }

    .conversion-input {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
        min-width: 0; /* Allow shrinking */
    }

    .unit-select {
        padding: 0.75rem 0.375rem;
        font-size: 0.75rem;
        min-width: 0; /* Allow shrinking */
        max-width: 100%;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
    }

    .category-selector {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.375rem;
    }

    .category-btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.6875rem;
    }

    .converter-header h2 {
        font-size: 1rem;
    }

    .swap-btn {
        width: 36px;
        height: 36px;
        font-size: 1.125rem;
    }
}

/* Small tablets and larger phones (576px+) */
@media (min-width: 576px) {
    .converter-container {
        max-width: 540px;
    }

    .category-selector {
        grid-template-columns: repeat(3, 1fr);
    }

    .category-btn {
        font-size: 0.8125rem;
        padding: 0.75rem 0.5rem;
    }

    .converter-header h2 {
        font-size: 1.25rem;
    }

    .conversion-input,
    .unit-select {
        font-size: 1rem;
    }

    .conversions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablets (768px+) */
@media (min-width: 768px) {
    .converter-container {
        max-width: 600px;
    }

    .category-selector {
        grid-template-columns: repeat(4, 1fr);
    }

    .category-btn {
        font-size: 0.875rem;
    }

    .conversion-row {
        grid-template-columns: 1.2fr 1fr;
    }
}

/* Desktops (1024px+) */
@media (min-width: 1024px) {
    .converter-container {
        max-width: 640px;
    }

    .category-selector {
        grid-template-columns: repeat(6, 1fr);
    }

    .converter-header h2 {
        font-size: 1.375rem;
    }
}

/* Large desktops (1280px+) */
@media (min-width: 1280px) {
    .converter-container {
        max-width: 680px;
    }
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {

    .category-selector,
    .common-conversions,
    .swap-btn {
        display: none;
    }

    .converter-container {
        box-shadow: none;
    }
}