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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    font-size: 14px;
    background-color: #f0f2f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

.portal-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.top-nav {
    height: 50px;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    color: #333;
    border-bottom: 1px solid #e8e8e8;
    z-index: 10;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 36px;
}

/* Main Body */
.main-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 16px 24px 0 24px;
    overflow: hidden;
}

.config-panel {
    display: flex;
    gap: 24px;
    height: 100%;
}

.panel-left {
    flex: 0 0 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    padding-bottom: 16px;
    padding-right: 8px;
}

.panel-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 16px;
}

.card {
    background: #fff;
    border-radius: 2px;
    border: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e8e8e8;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.refresh-tip {
    font-size: 12px;
    color: #52c41a;
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    padding: 1px 6px;
    border-radius: 2px;
}

.card-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

/* Forms */
.dense-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-item {
    flex: 1;
}

.form-item label {
    font-size: 12px;
    color: #666;
}

.form-item select, .form-item input[type="text"] {
    width: 100%;
    padding: 4px 11px;
    height: 32px;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
    font-size: 13px;
    color: #333;
    transition: all 0.3s;
}

.form-item select:focus, .form-item input[type="text"]:focus {
    border-color: #d82430;
    box-shadow: 0 0 0 2px rgba(216,36,48,0.2);
    outline: none;
}

.form-item input[type="color"] {
    width: 100%;
    height: 32px;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
    padding: 0;
    cursor: pointer;
}

.form-item input[type="range"] {
    width: 100%;
    margin-top: 4px;
}

.divider {
    height: 1px;
    background: #e8e8e8;
    margin: 4px 0;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
}

.checkbox-grid input[type="checkbox"] {
    cursor: pointer;
}

/* Action Bar */
.action-bar {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 2px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.url-input {
    width: 100%;
    padding: 4px 11px;
    height: 32px;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
    font-size: 12px;
    color: #666;
    background: #f5f5f5;
}

.btn-primary {
    width: 100%;
    height: 36px;
    background: #d82430;
    color: #fff;
    border: none;
    border-radius: 2px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 0 rgba(0,0,0,0.045);
}

.btn-primary:hover {
    background: #e8444f;
}

.btn-primary.copied {
    background: #52c41a;
    box-shadow: none;
}

.config-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-secondary {
    flex: 1;
    height: 32px;
    background: #fff;
    color: #333;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    color: #d82430;
    border-color: #d82430;
}

.help-text {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
    margin-top: -4px;
}

.css-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.chip {
    font-size: 11px;
    font-family: monospace;
    background: #f0f0f0;
    color: #333;
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid #d9d9d9;
    cursor: grab;
    user-select: none;
    transition: all 0.2s;
}

.chip:hover {
    background: #fde8e8;
    border-color: #f8b4b4;
    color: #d82430;
}

.chip:active {
    cursor: grabbing;
}

.css-textarea {
    width: 100%;
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    padding: 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    resize: vertical;
    background: #fafafa;
    color: #333;
    outline: none;
    box-sizing: border-box;
}

.css-textarea:focus {
    border-color: #d82430;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(216,36,48,0.2);
}

/* iframe area */
.preview-card {
    height: 100%;
}

.iframe-container {
    padding: 0;
    background: #f0f2f5;
    background-image: linear-gradient(45deg, #e8e8e8 25%, transparent 25%, transparent 75%, #e8e8e8 75%, #e8e8e8), linear-gradient(45deg, #e8e8e8 25%, transparent 25%, transparent 75%, #e8e8e8 75%, #e8e8e8);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
}
