/* 地图工具样式 - 与encrypt-style.css风格统一 */

:root {
    --primary-color: #4f8cff;
    --primary-dark: #1e40af;
    --success-color: #34d399;
    --success-dark: #059669;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --dark-color: #2d3a4b;
    --light-color: #f1f5f9;
    --gray-color: #6b7280;
    --border-radius: 18px;
    --small-radius: 12px;
    --box-shadow: 0 4px 24px 0 rgba(60, 72, 88, 0.12);
    --transition: all 0.28s cubic-bezier(.4,1.6,.6,1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.5;
    color: #2d3a4b;
    background: linear-gradient(135deg, #e0e7ff 0%, #f5f7fa 100%);
    min-height: 100vh;
    padding: 15px;
    padding-bottom: 80px;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
}

.app-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 18px;
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.app-title {
    color: var(--dark-color);
    font-size: 1.7rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: 0.5px;
}

.app-subtitle {
    color: var(--gray-color);
    font-size: 1rem;
    margin-top: 5px;
}

.app-author {
    color: var(--primary-color);
    font-size: 0.85rem;
    margin-top: 8px;
    font-weight: 600;
}

.app-qq-group {
    color: var(--warning-color);
    font-size: 0.85rem;
    margin-top: 3px;
    font-weight: 600;
}

.app-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 15px;
}

@media (max-width: 992px) {
    .app-content {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.panel-header {
    background: var(--dark-color);
    color: white;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.panel-body {
    padding: 16px;
}

.step-indicator {
    display: flex;
    margin-bottom: 15px;
    background: var(--light-color);
    border-radius: var(--small-radius);
    overflow: hidden;
    font-size: 0.9rem;
}

.step {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    font-weight: 600;
    position: relative;
    transition: all 0.2s;
}

.step.active {
    background: linear-gradient(90deg, #4f8cff 0%, #1e40af 100%);
    color: white;
}

.step.completed {
    background: linear-gradient(90deg, #34d399 0%, #059669 100%);
    color: white;
}

.file-upload-area {
    border: 2px dashed var(--primary-color);
    border-radius: var(--small-radius);
    padding: 18px 10px;
    text-align: center;
    margin-bottom: 15px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e0e7ef 100%);
    transition: var(--transition);
    cursor: pointer;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.file-upload-area:hover {
    background: linear-gradient(90deg, #e0e7ef 0%, #dbeafe 100%);
    border-color: #2563eb;
}

.file-upload-area h3 {
    margin-bottom: 5px;
    color: var(--dark-color);
    font-size: 1rem;
    font-weight: 600;
}

.file-upload-area p {
    color: var(--gray-color);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-info {
    margin-top: 12px;
    padding: 10px 12px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e0e7ef 100%);
    border-radius: var(--small-radius);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-color);
    transition: all 0.2s;
}

.file-info.has-file {
    background: linear-gradient(90deg, #d1fae5 0%, #a7f3d0 100%);
    color: var(--success-dark);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.file-type-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.file-type-btn {
    flex: 1;
    padding: 12px;
    text-align: center;
    background: linear-gradient(90deg, #f1f5f9 0%, #e0e7ef 100%);
    border-radius: var(--small-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid transparent;
    color: #374151;
    font-size: 0.95rem;
}

.file-type-btn:hover {
    background: linear-gradient(90deg, #e0e7ef 0%, #dbeafe 100%);
}

.file-type-btn.active {
    background: linear-gradient(90deg, #4f8cff 0%, #1e40af 100%);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px 0 rgba(79, 140, 255, 0.15);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 12px;
}

@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .image-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

.image-item {
    border: 1px solid #e5e7eb;
    border-radius: var(--small-radius);
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.image-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.image-item.replaced {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.image-item.replaced::before {
    content: "已替换";
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--success-color);
    color: white;
    font-size: 0.65rem;
    padding: 3px 6px;
    border-radius: 6px;
    z-index: 2;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(52, 211, 153, 0.3);
}

.image-number {
    font-weight: bold;
    margin-bottom: 6px;
    color: var(--dark-color);
    font-size: 0.85rem;
}

.image-preview {
    width: 100%;
    height: 75px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-info {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--gray-color);
    line-height: 1.3;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(90deg, #4f8cff 0%, #1e40af 100%);
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: var(--small-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    width: 100%;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px 0 rgba(79, 140, 255, 0.08);
}

.button:hover {
    background: linear-gradient(90deg, #2563eb 0%, #1e3a8a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px 0 rgba(79, 140, 255, 0.15);
}

.button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-success {
    background: linear-gradient(90deg, #34d399 0%, #059669 100%);
    box-shadow: 0 2px 8px 0 rgba(52, 211, 153, 0.08);
}

.button-success:hover {
    background: linear-gradient(90deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 12px 0 rgba(52, 211, 153, 0.15);
}

.button-danger {
    background: var(--danger-color);
}

.button-danger:hover {
    background: #c0392b;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.button-group .button {
    flex: 1;
}

.info-box {
    background: rgba(79, 140, 255, 0.08);
    border-left: 4px solid var(--primary-color);
    padding: 14px 16px;
    margin-bottom: 15px;
    border-radius: 0 var(--small-radius) var(--small-radius) 0;
    font-size: 0.9rem;
}

.info-box.warning {
    background: rgba(243, 156, 18, 0.08);
    border-left-color: var(--warning-color);
}

.info-box.success {
    background: rgba(52, 211, 153, 0.08);
    border-left-color: var(--success-color);
}

.log-container {
    background: var(--dark-color);
    color: #e2e8f0;
    padding: 14px 16px;
    border-radius: var(--small-radius);
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    max-height: 180px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.6;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(30, 41, 59, 0.18);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #fff;
    margin: 10% auto;
    padding: 24px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 480px;
    box-shadow: 0 8px 32px 0 rgba(60, 72, 88, 0.18);
    animation: modalFadeIn 0.32s cubic-bezier(.4,1.6,.6,1);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-50px) scale(0.85); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.modal-title {
    font-size: 1.25rem;
    color: var(--dark-color);
    font-weight: 600;
}

.close {
    color: var(--gray-color);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.close:hover {
    color: var(--dark-color);
    transform: rotate(90deg);
}

.notification {
    position: fixed;
    top: 18px;
    right: 18px;
    padding: 14px 18px;
    border-radius: var(--small-radius);
    color: white;
    font-weight: 600;
    z-index: 2000;
    opacity: 0;
    transition: var(--transition);
    max-width: 380px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    font-size: 0.95rem;
    letter-spacing: 0.2px;
}

.notification.show {
    opacity: 1;
}

.notification.success {
    background: linear-gradient(90deg, #34d399 0%, #059669 100%);
}

.notification.error {
    background: linear-gradient(90deg, #e74c3c 0%, #c0392b 100%);
}

.notification.warning {
    background: linear-gradient(90deg, #f39c12 0%, #e67e22 100%);
}

.empty-state {
    text-align: center;
    padding: 35px 18px;
    color: var(--gray-color);
}

.empty-state i {
    font-size: 2.8rem;
    margin-bottom: 12px;
    color: #cbd5e1;
}

.empty-state h3 {
    margin-bottom: 6px;
    color: var(--dark-color);
}

.stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e0e7ef 100%);
    border-radius: var(--small-radius);
    padding: 14px 12px;
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-color);
    margin-top: 4px;
    font-weight: 600;
}

.icon {
    display: inline-block;
    width: 22px;
    height: 22px;
    background-size: contain;
    background-repeat: no-repeat;
}

.icon-file {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234f8cff'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14,2 14,8 20,8'/%3E%3C/svg%3E");
}

.icon-image {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234f8cff'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21,15 16,10 5,21'/%3E%3C/svg%3E");
}

.icon-save {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M17 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z'/%3E%3C/svg%3E");
}

.icon-upload {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234f8cff'%3E%3Cpath d='M9 16h6v-6h4l-7-7-7 7h4v6zm-4 2h14v2H5v-2z'/%3E%3C/svg%3E");
}

.fixed-save-button {
    position: fixed;
    bottom: 18px;
    left: 18px;
    right: 18px;
    z-index: 100;
}

.fixed-save-button .button {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.loading {
    display: none;
    text-align: center;
    padding: 10px;
    color: var(--primary-color);
}

.loading-spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.file-structure-info {
    margin-top: 12px;
    padding: 12px 14px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e0e7ef 100%);
    border-radius: var(--small-radius);
    font-size: 0.85rem;
}

.structure-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    padding: 4px 0;
}

.structure-name {
    color: var(--dark-color);
    font-weight: 600;
}

.structure-value {
    color: var(--gray-color);
}

.hex-view {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    background: var(--dark-color);
    color: #e2e8f0;
    padding: 10px 12px;
    border-radius: 8px;
    margin-top: 8px;
    overflow-x: auto;
    white-space: pre;
}

/* ICOS_5贴片工具特定样式 */
.icos-tools {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 15px;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .icos-tools {
        grid-template-columns: 1fr;
    }
}

.icos-panel {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.icos-panel-header {
    background: var(--dark-color);
    color: white;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.icos-panel-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.icos-panel-body {
    padding: 16px;
}

.icos-file-upload-area {
    border: 2px dashed var(--warning-color);
    border-radius: var(--small-radius);
    padding: 18px 10px;
    text-align: center;
    margin-bottom: 15px;
    background: linear-gradient(90deg, #fef3c7 0%, #fde68a 100%);
    transition: var(--transition);
    cursor: pointer;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.icos-file-upload-area:hover {
    background: linear-gradient(90deg, #fde68a 0%, #fcd34d 100%);
}

.icos-file-info {
    margin-top: 12px;
    padding: 10px 12px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e0e7ef 100%);
    border-radius: var(--small-radius);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-color);
}

.icos-file-info.has-file {
    background: linear-gradient(90deg, #d1fae5 0%, #a7f3d0 100%);
    color: var(--success-dark);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.compression-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e0e7ef 100%);
    border-radius: var(--small-radius);
    padding: 14px 12px;
}

.compression-item {
    text-align: center;
    flex: 1;
}

.compression-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-color);
}

.compression-label {
    font-size: 0.75rem;
    color: var(--gray-color);
    margin-top: 4px;
    font-weight: 600;
}

/* ICOS统计信息样式 */
.icos-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    background: linear-gradient(90deg, #f1f5f9 0%, #e0e7ef 100%);
    border-radius: var(--small-radius);
    padding: 14px 12px;
}

.icos-stat-item {
    text-align: center;
    flex: 1;
}

.icos-stat-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-color);
}

.icos-stat-label {
    font-size: 0.85rem;
    color: var(--gray-color);
    margin-top: 4px;
    font-weight: 600;
}

/* ICOS图片项样式 */
.icos-image-name {
    font-weight: bold;
    margin-bottom: 6px;
    color: var(--dark-color);
    font-size: 0.8rem;
    word-break: break-all;
    line-height: 1.3;
}

/* 移动端适配 */
@media (max-width: 600px) {
    body {
        padding: 10px;
        padding-bottom: 80px;
    }
    
    .app-header {
        padding: 14px;
    }
    
    .app-title {
        font-size: 1.35rem;
    }
    
    .app-subtitle {
        font-size: 0.9rem;
    }
    
    .app-author, .app-qq-group {
        font-size: 0.8rem;
    }
    
    .panel {
        border-radius: var(--small-radius);
    }
    
    .file-type-selector {
        gap: 8px;
    }
    
    .file-type-btn {
        padding: 10px;
        font-size: 0.85rem;
    }
    
    .image-preview {
        height: 65px;
    }
    
    .notification {
        right: 12px;
        left: 12px;
        max-width: 100%;
        font-size: 0.85rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 15% auto;
        padding: 20px;
    }
    
    .stats, .compression-info, .icos-stats {
        padding: 12px 10px;
    }
}
