* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1000px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    padding: 40px 30px;
    border-bottom: 1px solid #e0e0e0;
}

header h1 {
    font-size: 32px;
    color: #1a1a1a;
    font-weight: 600;
}

main {
    padding: 40px 30px;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.input-area,
.output-area {
    width: 100%;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.input-area:focus,
.output-area:focus {
    outline: none;
    border-color: #1db854;
}

.input-area {
    background: #fafafa;
    min-height: 200px;
    color: #333;
}

.output-area {
    background: #f0f0f0;
    color: #333;
    cursor: text;
}

.options-section {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    align-items: center;
}

.toggle-group {
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-input {
    display: none;
}

.toggle-switch {
    width: 50px;
    height: 28px;
    background-color: #ddd;
    border-radius: 14px;
    position: relative;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: left 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-switch {
    background-color: #ff6b6b;
}

.toggle-input:checked + .toggle-switch::after {
    left: 24px;
}

.toggle-text {
    font-size: 15px;
    color: #333;
    font-weight: 500;
}

.convert-btn {
    width: 100%;
    padding: 16px;
    background-color: #1db854;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(29, 184, 84, 0.3);
}

.convert-btn:hover {
    background-color: #1a9c45;
    box-shadow: 0 6px 16px rgba(29, 184, 84, 0.4);
    transform: translateY(-2px);
}

.convert-btn:active {
    transform: translateY(0);
}

.convert-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.convert-btn svg {
    width: 20px;
    height: 20px;
}

/* Result Section */
.result-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    animation: slideIn 0.3s ease;
}

.result-section.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.result-header h2 {
    font-size: 18px;
    color: #1a1a1a;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

.copy-btn {
    padding: 12px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.copy-btn:hover {
    background-color: #0056b3;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 40px 20px;
    text-align: center;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #1db854;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading p {
    color: #666;
    font-size: 14px;
}

/* Error Message */
.error-message {
    padding: 15px 20px;
    background-color: #fee;
    border: 2px solid #f44;
    border-radius: 8px;
    color: #c33;
    font-size: 14px;
    animation: slideIn 0.3s ease;
}

.error-message.hidden {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 24px;
    }

    main {
        padding: 25px 20px;
    }

    .form-section {
        gap: 20px;
    }

    .input-area,
    .output-area {
        padding: 12px;
        font-size: 13px;
        min-height: 150px;
    }

    .options-section {
        gap: 15px;
        flex-direction: column;
        align-items: flex-start;
    }

    .toggle-group {
        width: 100%;
    }

    .toggle-label {
        gap: 10px;
    }

    .convert-btn {
        padding: 14px;
        font-size: 15px;
    }

    .result-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .result-header h2 {
        font-size: 16px;
    }

    .copy-btn {
        width: 100%;
        padding: 14px;
        align-self: stretch;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 8px;
    }

    header {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 20px;
    }

    main {
        padding: 20px 15px;
    }

    .form-section {
        gap: 15px;
    }

    .input-area,
    .output-area {
        padding: 10px;
        font-size: 12px;
        min-height: 120px;
    }

    .options-section {
        gap: 10px;
    }

    .toggle-label {
        gap: 8px;
    }

    .toggle-text {
        font-size: 14px;
    }

    .convert-btn {
        padding: 12px;
        font-size: 14px;
        gap: 8px;
    }

    .convert-btn svg {
        width: 18px;
        height: 18px;
    }

    .loading {
        padding: 30px 15px;
        gap: 12px;
    }

    .spinner {
        width: 32px;
        height: 32px;
        border-width: 3px;
    }

    .loading p {
        font-size: 13px;
    }

    .error-message {
        padding: 12px 15px;
        font-size: 13px;
    }
}
