/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Header */
header {
    text-align: center;
    padding: 2rem 1rem;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Input section */
.input-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

#input-text {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#input-text:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    gap: 1rem;
}

.char-count {
    font-size: 0.9rem;
    color: #666;
}

.clear-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.clear-btn:hover {
    background: #ff5252;
    transform: translateY(-1px);
}

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

/* Output section */
.output-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.converter-grid {
    display: grid;
    gap: 1.2rem;
    grid-template-columns: 1fr;
    max-width: 95%;
    margin-left: -30px;
}

.converter-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #c2c2c2;
    transition: box-shadow 0.3s ease;
}

.converter-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.converter-item h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #495057;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.output-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.output-field {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    color: #495057;
    min-height: 44px;
}

.output-field:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.copy-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    min-height: 44px;
}

.copy-btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

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

.copy-btn.copied {
    background: #48bb78;
}

.copy-icon {
    font-size: 1rem;
}

/* Copy notification */
.copy-notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: #48bb78;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

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

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: white;
    opacity: 0.8;
}

footer a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

/* Tablet styles */
@media (min-width: 768px) {
    header h1 {
        font-size: 3rem;
    }
    
    .converter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    main {
        padding: 3rem 2rem;
    }
}

/* Desktop styles */
@media (min-width: 1024px) {
    .converter-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 92%;
    }
    
    .input-section,
    .output-section {
        padding: 3rem;
    }
}

/* Large desktop styles */
@media (min-width: 1200px) {
    .converter-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.8rem;
        max-width: 90%;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    body {
        background: #000;
        color: #fff;
    }
    
    .input-section,
    .output-section {
        background: #111;
        border: 1px solid #fff;
    }
    
    .converter-item {
        background: #222;
        border: 1px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
textarea:focus,
input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Loading state */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
