/**
 * Professional Length Converter CSS
 * CalcTechLab.com
 * Modern, responsive, and accessible design
 */

/* ========================================
   1. RESET & BASE STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   2. HEADER SECTION
   ======================================== */

.converter-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    animation: fadeInDown 0.6s ease;
}

.converter-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.converter-header .subtitle {
    font-size: 1.3rem;
    opacity: 0.95;
    font-weight: 300;
}

.converter-header .icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    display: inline-block;
    animation: bounce 2s ease infinite;
}

/* ========================================
   3. MAIN LAYOUT
   ======================================== */

.converter-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    margin-bottom: 40px;
}

/* ========================================
   4. CONVERTER CARD
   ======================================== */

.converter-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: fadeIn 0.8s ease;
}

.converter-header-section {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    padding: 25px 30px;
    color: white;
}

.converter-header-section h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.converter-header-section p {
    opacity: 0.9;
    font-size: 1rem;
}

/* ========================================
   5. CONVERTER FORM
   ======================================== */

.converter-form {
    padding: 40px;
}

.conversion-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: start;
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    font-weight: 600;
    color: #1e40af;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
}

.converter-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
}

.converter-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.converter-input.loading {
    background: linear-gradient(90deg, #f8fafc 25%, #e2e8f0 50%, #f8fafc 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease infinite;
}

.converter-input:disabled {
    background: #f8fafc;
    cursor: not-allowed;
}

.unit-select {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

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

/* ========================================
   6. SWAP BUTTON
   ======================================== */

.swap-button-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 35px;
}

.swap-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.swap-btn:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

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

/* ========================================
   7. FORMULA DISPLAY
   ======================================== */

.formula-section {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    border-left: 4px solid #2563eb;
}

.formula-section h3 {
    color: #1e40af;
    font-size: 1rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.formula-display {
    font-size: 1.2rem;
    color: #1e40af;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* ========================================
   8. ACTION BUTTONS
   ======================================== */

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.action-btn {
    padding: 12px 30px;
    border: 2px solid #2563eb;
    background: white;
    color: #2563eb;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn:hover {
    background: #2563eb;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn.primary {
    background: #2563eb;
    color: white;
}

.action-btn.primary:hover {
    background: #1e40af;
}

.action-btn.success {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

/* ========================================
   9. SIDEBAR
   ======================================== */

.converter-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: fadeInRight 0.8s ease;
}

.sidebar-card h3 {
    color: #2563eb;
    margin-bottom: 15px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-card .icon {
    font-size: 1.5rem;
}

/* ========================================
   10. QUICK CONVERSIONS
   ======================================== */

.quick-conversions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-convert-btn {
    padding: 12px 15px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 0.95rem;
    color: #1e40af;
    font-weight: 500;
}

.quick-convert-btn:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #2563eb;
    transform: translateX(5px);
}

.quick-convert-btn .arrow {
    margin: 0 8px;
    color: #2563eb;
}

/* ========================================
   11. CONVERSION HISTORY
   ======================================== */

.history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: #e2e8f0;
    transform: translateX(5px);
}

.history-value {
    font-family: 'Courier New', monospace;
    color: #1e40af;
    font-weight: 600;
}

.history-arrow {
    color: #2563eb;
    font-weight: bold;
}

.history-use-btn {
    padding: 6px 12px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.history-use-btn:hover {
    background: #1e40af;
}

.no-history {
    text-align: center;
    color: #94a3b8;
    font-style: italic;
    padding: 20px;
}

/* ========================================
   12. CONVERSION TABLE
   ======================================== */

.table-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-top: 40px;
}

.table-section h2 {
    color: #2563eb;
    margin-bottom: 25px;
    font-size: 2rem;
}

.table-controls {
    margin-bottom: 25px;
}

.table-controls label {
    font-weight: 600;
    color: #1e40af;
    margin-right: 10px;
}

.conversion-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.conversion-table thead {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.conversion-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.conversion-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
}

.conversion-table tbody tr:hover {
    background: #f8fafc;
}

.conversion-table tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   13. SEO CONTENT SECTION
   ======================================== */

.seo-content {
    background: white;
    border-radius: 20px;
    padding: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-top: 40px;
}

.seo-content h2 {
    color: #2563eb;
    margin-bottom: 25px;
    font-size: 2.2rem;
}

.seo-content h3 {
    color: #1e40af;
    margin-top: 35px;
    margin-bottom: 15px;
    font-size: 1.6rem;
}

.seo-content h4 {
    color: #2563eb;
    margin-top: 25px;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.seo-content p {
    color: #64748b;
    line-height: 1.8;
    margin-bottom: 15px;
    font-size: 1.05rem;
}

.seo-content ul,
.seo-content ol {
    color: #64748b;
    line-height: 1.8;
    margin-bottom: 20px;
    padding-left: 30px;
}

.seo-content li {
    margin-bottom: 10px;
}

.seo-content strong {
    color: #1e40af;
    font-weight: 600;
}

.seo-content code {
    background: #f8fafc;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #2563eb;
}

/* FAQ Section */
.faq-section {
    margin-top: 40px;
}

.faq-item {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid #2563eb;
}

.faq-question {
    color: #1e40af;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.faq-answer {
    color: #64748b;
    line-height: 1.7;
}

/* ========================================
   14. NOTIFICATIONS
   ======================================== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    font-weight: 600;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: #10b981;
    color: white;
}

.notification-error {
    background: #ef4444;
    color: white;
}

.notification-info {
    background: #2563eb;
    color: white;
}

/* ========================================
   15. LOADING INDICATOR
   ======================================== */

.loading-indicator {
    display: none;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   16. ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========================================
   17. RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
    .converter-layout {
        grid-template-columns: 1fr;
    }
    
    .converter-sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .converter-header h1 {
        font-size: 2rem;
    }
    
    .converter-header .subtitle {
        font-size: 1rem;
    }
    
    .converter-form {
        padding: 25px;
    }
    
    .conversion-row {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .swap-button-wrapper {
        padding-top: 0;
        order: 2;
    }
    
    .swap-btn {
        transform: rotate(90deg);
    }
    
    .converter-input {
        font-size: 1.2rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .seo-content {
        padding: 30px 20px;
    }
    
    .seo-content h2 {
        font-size: 1.8rem;
    }
    
    .conversion-table {
        font-size: 0.9rem;
    }
    
    .conversion-table th,
    .conversion-table td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .converter-header h1 {
        font-size: 1.6rem;
    }
    
    .converter-input {
        font-size: 1rem;
        padding: 12px 15px;
    }
    
    .unit-select {
        font-size: 0.9rem;
    }
    
    .sidebar-card {
        padding: 20px;
    }
    
    .conversion-table {
        font-size: 0.85rem;
    }
}

/* ========================================
   18. PRINT STYLES
   ======================================== */

@media print {
    body {
        background: white;
    }
    
    .converter-header,
    .action-buttons,
    .converter-sidebar,
    .notification {
        display: none;
    }
    
    .converter-card {
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
}

/* ========================================
   19. ACCESSIBILITY
   ======================================== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

/* ========================================
   20. EMBED MODE STYLES
   ======================================== */

.embed-mode {
    padding: 0;
}

.embed-mode .converter-header,
.embed-mode .converter-sidebar,
.embed-mode .seo-content {
    display: none;
}

.embed-mode .converter-card {
    border-radius: 0;
    box-shadow: none;
}

.embed-mode .converter-layout {
    grid-template-columns: 1fr;
    gap: 0;
    margin: 0;
}