/* styles.css */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css');

:root {
    --background-light: #ffffff;
    --text-light: #333333;
    --border-light: #edf1f7;
    --shadow-light: rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    background: #ffffff;
    color: #333333;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.5s ease;
}

header {
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    padding: 15px 0;
    box-shadow: 0 4px 20px rgba(36, 198, 220, 0.1);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 45%, rgba(255,255,255,0.1) 50%, transparent 55%);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.header-content {
    text-align: center;
    padding: 0 60px;
}

.header-content h1 {
    color: white;
    font-size: min(2.5vw + 1.2rem, 2rem);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 1px;
    margin: 0;
}

.back-link {
    position: absolute;
    top: 15px;
    left: 15px;
    display: inline-flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    font-size: 14px;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.back-link:hover {
    transform: translateX(-5px);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

.back-link::before {
    content: '←';
    margin-right: 6px;
    transition: transform 0.3s ease;
    display: inline-block;
}

.back-link:hover::before {
    transform: translateX(-5px);
}

.main-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: min(4vw, 40px);
    margin-bottom: 20px;
    height: calc(90vh - 150px);
    min-height: 400px;
}

.input-section, .output {
    background: #ffffff;
    padding: min(3vw, 30px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #edf1f7;
}

.input-section:hover, .output:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.section-header p {
    color: #514A9D;
    font-size: min(1.8vw + 0.8rem, 1.2rem);
    font-weight: 600;
    margin: 0;
}

textarea {
    width: 100%;
    flex: 1;
    padding: 20px;
    border: 2px solid #edf1f7;
    border-radius: 8px;
    resize: none;
    font-family: 'Roboto Mono', monospace;
    font-size: min(1.2vw + 0.7rem, 1rem);
    line-height: 1.5;
    background: #ffffff;
    color: #333333;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

textarea:focus {
    outline: none;
    border-color: #24C6DC;
    box-shadow: 0 0 0 4px rgba(36, 198, 220, 0.15);
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: auto;
}

button {
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    color: white;
    padding: min(1.5vw + 8px, 15px) min(2vw + 15px, 30px);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: min(1.2vw + 0.7rem, 1rem);
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(36, 198, 220, 0.1);
    flex: 1;
    justify-content: center;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(36, 198, 220, 0.3);
}

.copy-btn {
    background: #f8f9fa;
    color: #514A9D;
    border: 1px solid #edf1f7;
    box-shadow: none;
}

.copy-btn:hover {
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(36, 198, 220, 0.2);
    border: none;
}

.error-message {
    margin-top: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    background-color: #fce8e6;
    color: #d93025;
    border: 1px solid #fad2cf;
    animation: fadeIn 0.3s ease;
}

.copy-tooltip {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    display: none;
    box-shadow: 0 4px 20px rgba(36, 198, 220, 0.3);
    z-index: 9999;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tooltip-symbol {
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
}

.copy-tooltip.show {
    display: flex;
    opacity: 1;
    visibility: visible;
    animation: tooltipSlide 0.5s ease;
}

.copy-tooltip::before {
    display: none;
}

@keyframes tooltipSlide {
    0% {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

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

/* 响应式布局 */
@media screen and (max-width: 768px) {
    .container {
        width: 95%;
        padding: 15px;
    }

    .main-content {
        grid-template-columns: 1fr;
        height: auto;
        gap: 20px;
    }

    .input-section, .output {
        height: min(70vh, 500px);
    }

    textarea {
        font-size: 16px;
    }

    button {
        padding: 12px 20px;
        font-size: 16px;
    }
}

@media screen and (max-width: 480px) {
    .container {
        width: 100%;
        padding: 10px;
    }

    .input-section, .output {
        padding: 15px;
        height: min(60vh, 400px);
    }

    .section-header p {
        font-size: 1.1rem;
    }

    textarea {
        padding: 15px;
    }

    button {
        padding: 10px 15px;
    }
}

/* 优化关键样式 - 确保页面基本布局在完整CSS加载前可见 */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}