/* Modern CSS Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    line-height: 1.5;
}

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

/* Container and Layout */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

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

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.converter-section {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
}

/* Input Mode Toggle */
.input-mode-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
}

.mode-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.mode-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

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

/* Input Modes */
.input-mode {
    display: none;
}

.input-mode.active {
    display: block;
}

/* Input Group */
.input-group {
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
    font-size: 1rem;
}

#duration-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: #f9fafb;
    transition: all 0.2s ease;
}

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

#duration-input:invalid {
    border-color: #ef4444;
}

.input-hint {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* Duration Fields */
.duration-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
}

.field-group label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
    text-align: center;
}

.field-group input {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 1rem;
    text-align: center;
    background: #f9fafb;
    transition: all 0.2s ease;
}

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

.field-group input:invalid {
    border-color: #ef4444;
}

.field-group input.warning {
    border-color: #f59e0b;
    background: #fffbeb;
}

/* Output Group */
.output-group {
    margin-bottom: 1.5rem;
}

.output-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
    font-size: 1rem;
}

.output-container {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.output-display {
    flex: 1;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    font-size: 1rem;
    line-height: 1.5;
    min-height: 3rem;
    display: flex;
    align-items: center;
    word-break: break-word;
}

.output-display.has-content {
    background: white;
    border-color: #10b981;
    color: #065f46;
    font-weight: 500;
}

.copy-button {
    padding: 1rem 1.5rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

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

.copy-button:active:not(:disabled) {
    transform: translateY(0);
}

.copy-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.copy-button.copied {
    background: #10b981;
}

/* Remove the ::after pseudo-element approach */

/* Error Message */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #dc2626;
    font-size: 0.875rem;
}

.error-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    color: white;
    opacity: 0.8;
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem 0.75rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .converter-section {
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    .input-mode-toggle {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .mode-btn {
        justify-content: center;
    }
    
    .duration-fields {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .output-container {
        flex-direction: column;
    }
    
    .copy-button {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .converter-section {
        padding: 1.25rem;
    }
    
    .duration-fields {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .field-group input {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    #duration-input,
    .output-display {
        font-size: 0.875rem;
    }
}

/* Animation for smooth transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.converter-section {
    animation: fadeIn 0.5s ease-out;
}

/* Focus styles for accessibility */
.copy-button:focus-visible,
#duration-input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .converter-section {
        border: 2px solid #000;
    }
    
    #duration-input,
    .output-display {
        border-width: 2px;
    }
}

/* Footer link styles for gradient background */
footer a {
    color: white !important;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

footer a:hover {
    color: white !important;
    border-bottom-color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

footer a:focus {
    outline: 2px solid white;
    outline-offset: 2px;
    border-radius: 2px;
}