/* Code Format Page Styles */

html.code-format-page,
body.code-format-page {
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.code-format-page {
    overflow-y: auto !important;
}

body.code-format-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f3f4f6;
    display: flex !important;
    flex-direction: column !important;
}

/* Header */
.code-format-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0.75rem 0;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.code-format-header .container {
    max-width: 1200px !important;
    margin: 0 auto;
    padding: 0 1rem;
}

.code-format-header .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.code-format-header .logo {
    display: flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}

.code-format-header .logo i {
    margin-right: 0.5rem;
    font-size: 1.75rem;
}

.code-format-header .header-nav {
    display: flex;
    gap: 2rem;
}

.code-format-header .nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.code-format-header .nav-link:hover,
.code-format-header .nav-link.active {
    color: #fff;
    font-weight: 600;
}

.code-format-header .language-selector {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.875rem;
    cursor: pointer;
}

.code-format-header .language-selector option {
    color: #1f2937;
    background: #fff;
}

/* Main Content */
body.code-format-page .code-format-main {
    flex: 1 !important;
    padding: 0.75rem;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box;
    overflow: hidden;
}

body.code-format-page .code-format-main .container {
    max-width: none !important;
    margin: 0;
    padding: 0;
    width: 100%;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    min-height: 0;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    flex-shrink: 0;
}

/* Type Tabs */
.type-tabs {
    display: flex;
    gap: 0.5rem;
}

.type-tab {
    padding: 0.5rem 1.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.type-tab:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.type-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: #fff;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toolbar-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.format-type-select {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #1f2937;
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.format-type-select:focus {
    outline: none;
    border-color: #667eea;
}

.toolbar-right {
    display: flex;
    gap: 0.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* Format Container */
body.code-format-page .format-container {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 0;
}

.format-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 230px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.panel-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.panel-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 250px;
}

.code-textarea {
    width: 100%;
    height: calc(100% - 0px);
    min-height: 250px;
    padding: 1rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #1f2937;
    background: #fff;
    border: none;
    box-sizing: border-box;
    resize: none;
    outline: none;
    overflow-y: auto;
    overflow-x: auto;
    position: absolute;
    top: 0;
    left: 0;
}

/* 输入框有内容时的背景色 - 浅蓝色 */
.input-panel .code-textarea.has-content {
    background: rgba(190, 255, 170, 0.1);
}

/* 输出框有内容时的背景色 - 浅黄色 */
.output-panel .code-textarea.has-content {
    background: rgba(255, 170, 170, 0.1);
}

.code-textarea:focus {
    outline: none;
}

.code-textarea::placeholder {
    color: #9ca3af;
}

.divider {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    height: 48px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.divider .format-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.divider .format-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.divider .format-btn i {
    font-size: 1rem;
    order: 2;
}

/* Format Options */
.format-options {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-top: 0.75rem;
    flex-shrink: 0;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.option-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.option-select {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #1f2937;
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
    cursor: pointer;
    margin-left: 1rem;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Responsive Design */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column !important;
        gap: 1rem;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: center;
    }

    .format-container {
        flex-direction: column !important;
    }

    .divider {
        width: 100% !important;
        height: 48px !important;
        border-left: none !important;
        border-right: none !important;
        border-top: 1px solid #e5e7eb !important;
        border-bottom: 1px solid #e5e7eb !important;
        justify-content: flex-start !important;
    }

    body.code-format-page .divider .format-btn i {
        transform: rotate(0deg) !important;
    }

    body.code-format-page .format-options {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 1rem !important;
        flex-wrap: nowrap !important;
    }

    body.code-format-page .format-options .option-group {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.75rem !important;
        flex-wrap: nowrap !important;
    }

    .code-format-header .header-nav {
        display: none;
    }
}