/* 在线图片转ICO工具样式 */

/* ==========================================================================
   基础布局
   ========================================================================== */

.ico-converter-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Toast消息
   ========================================================================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 400px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid #3b82f6;
}

.toast.success {
    border-left-color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.info {
    border-left-color: #3b82f6;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    color: #1f2937;
    line-height: 1.5;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOutRight 0.3s ease-out forwards;
}

/* ==========================================================================
   错误消息
   ========================================================================== */
.error-message {
    display: none;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-left: 4px solid #ef4444;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.error-message.show {
    display: block;
}

/* ==========================================================================
   转换表单
   ========================================================================== */

.converter-form {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    transition: box-shadow 0.3s ease;
}

.converter-form:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* ==========================================================================
   表单区域
   ========================================================================== */
.form-section {
    margin-bottom: 20px;
}

.form-section label {
    display: block;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
    font-size: 14px;
}

/* ==========================================================================
   文件上传区域
   ========================================================================== */
.file-upload-area {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload-area:hover {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    transform: scale(1.01);
}

.file-upload-area.drag-over {
    border-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.upload-text {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
}

.upload-text strong {
    color: #3b82f6;
    font-weight: 600;
}

.upload-hint {
    font-size: 12px;
    color: #9ca3af;
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ==========================================================================
   文件信息
   ========================================================================== */

.file-info {
    display: none;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #10b981;
    border-radius: 6px;
    padding: 12px 16px;
    margin-top: 12px;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.file-info.show {
    display: flex;
}

.file-name {
    color: #065f46;
    font-weight: 500;
    font-size: 14px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-remove {
    background: #dc2626;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 12px;
}

.file-remove:hover {
    background: #b91c1c;
    transform: scale(1.05);
}

/* ==========================================================================
   预览容器
   ========================================================================== */

.preview-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #e5e7eb;
    animation: fadeIn 0.3s ease-out;
}

.preview-container.hidden {
    display: none;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-weight: 600;
    color: #1f2937;
    font-size: 15px;
}

.preview-size {
    color: #6b7280;
    font-size: 13px;
    font-weight: 400;
}

.preview-image-wrapper {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 8px;
}

.preview-image-wrapper img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.preview-image-wrapper img:hover {
    transform: scale(1.02);
}

/* ==========================================================================
   尺寸网格
   ========================================================================== */
.size-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.size-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.size-option:hover {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.size-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.size-option input[type="checkbox"]:checked + .size-label {
    color: #3b82f6;
    font-weight: 700;
}

.size-option input[type="checkbox"]:checked ~ .size-desc {
    color: #3b82f6;
}

.size-option input[type="checkbox"]:checked ~ * {
    /* Empty selector to trigger repaint */
}

.size-option:has(input[type="checkbox"]:checked) {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.size-label {
    font-weight: 600;
    color: #1f2937;
    font-size: 15px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.size-desc {
    color: #6b7280;
    font-size: 12px;
    transition: all 0.2s ease;
}

.size-tips {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.6;
    padding: 12px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 6px;
    border-left: 3px solid #f59e0b;
    animation: fadeIn 0.3s ease-out 0.2s both;
}

/* ==========================================================================
   选项网格
   ========================================================================== */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.option-checkbox {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.option-checkbox:hover {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.option-checkbox input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option-checkbox span {
    color: #1f2937;
    font-size: 14px;
    font-weight: 500;
}

/* ==========================================================================
   颜色选择器
   ========================================================================== */
.color-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-selector input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
}

.color-selector #bgColorValue {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
}

.color-tip {
    color: #6b7280;
    font-size: 12px;
}

/* ==========================================================================
   按钮组
   ========================================================================== */
.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn.loading {
    position: relative;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-reset {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.btn-reset:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
}

.btn-download {
    width: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 16px;
    padding: 14px 28px;
}

.btn-download:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* 加载状态 */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
}

.loading.show {
    display: block;
}

.spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: #6b7280;
    font-size: 14px;
}

/* ==========================================================================
   结果区域
   ========================================================================== */

.result-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    border: 2px solid #10b981;
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-section.hidden {
    display: none;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.result-title {
    font-size: 18px;
    font-weight: 700;
    color: #065f46;
}

.result-content {
    display: grid;
    gap: 20px;
}

.result-preview {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 8px;
    padding: 20px;
}

.result-preview-header {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 16px;
    font-size: 15px;
}

.result-preview-sizes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 16px;
}

.result-preview-item {
    text-align: center;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-preview-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
    transform: translateY(-4px) scale(1.05);
    cursor: pointer;
    z-index: 1;
}

.result-preview-item canvas {
    display: block;
    margin: 0 auto 8px;
    border-radius: 4px;
}

.result-preview-size-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.result-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-radius: 8px;
    padding: 20px;
}

.result-info h4 {
    margin: 0 0 12px 0;
    color: #1f2937;
    font-size: 15px;
}

.result-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.result-info li {
    padding: 8px 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.6;
    border-bottom: 1px solid #cbd5e1;
}

.result-info li:last-child {
    border-bottom: none;
}

.result-download {
    margin-top: 12px;
}

.result-success-tip {
    color: #065f46;
    font-size: 13px;
    margin: 12px 0 0 0;
    line-height: 1.6;
}

/* ==========================================================================
   使用提示
   ========================================================================== */

.tips-section {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-out;
}

.tips-section h4 {
    margin: 0 0 12px 0;
    color: #1e40af;
    font-size: 16px;
    font-weight: 700;
}

.tips-section ul {
    margin: 0;
    padding-left: 20px;
}

.tips-section li {
    color: #1e40af;
    line-height: 1.8;
    font-size: 14px;
    margin-bottom: 6px;
}

.tips-section li strong {
    font-weight: 700;
}

.tips-section-green {
    margin-top: 10px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left-color: #10b981;
}

.tips-section-blue {
    margin-top: 10px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left-color: #3b82f6;
}

.tips-section-yellow {
    margin-top: 10px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left-color: #f59e0b;
}

/* ==========================================================================
   通用隐藏类
   ========================================================================== */

.hidden {
    display: none !important;
}

/* ==========================================================================
   响应式设计
   ========================================================================== */

/* 大屏幕 (<=1024px) */
@media (max-width: 1024px) {
    .size-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 12px;
    }
}

/* 平板 (<=768px) */
@media (max-width: 768px) {
    .ico-converter-container {
        padding: 12px;
    }

    .converter-form {
        padding: 16px;
    }

    .size-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .result-preview-sizes {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手机 (<=640px) */
@media (max-width: 640px) {
    .size-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .result-preview-sizes {
        grid-template-columns: 1fr;
    }
    
    .upload-icon {
        font-size: 40px;
    }
    
    .file-upload-area {
        padding: 30px 15px;
    }
    
    .preview-image-wrapper img {
        max-height: 200px;
    }
    
    .btn {
        font-size: 13px;
        padding: 10px 20px;
    }
    
    .tips-section {
        padding: 16px;
    }
    
    .tips-section h4 {
        font-size: 14px;
    }
    
    .tips-section li {
        font-size: 13px;
    }
}
