/* ═══ MMS Studio — Graphic & GIF Generator ═══ */

.ms-cockpit {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-body, #f0f4f8);
}

/* Header */
.ms-header {
    padding: 20px 24px 0;
}
.ms-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    margin: 0;
}
.ms-header p {
    font-size: 13px;
    color: var(--text-secondary, #64748b);
    margin: 4px 0 0;
}

/* Tabs */
.ms-tabs {
    display: flex;
    gap: 0;
    padding: 16px 24px 0;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
}
.ms-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.ms-tab:hover { color: var(--text-primary, #1e293b); }
.ms-tab.active {
    color: #e85d04;
    border-bottom-color: #e85d04;
}

/* Tab Content */
.ms-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}
.ms-tab-content.active {
    display: flex;
    flex-direction: row;
}
.ms-tab-content.active[data-tab-content='gallery'] {
    flex-direction: column;
}

/* ── Studio Tab ── */
.ms-studio-scroll {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 20px 24px;
}
.ms-studio-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 480px;
}

/* Preview Panel */
.ms-preview-panel {
    width: 380px;
    min-width: 320px;
    border-left: 1px solid var(--border-light, #e2e8f0);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #1a1a2e;
}
.ms-preview-frame {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    max-width: 100%;
    position: relative;
}
.ms-preview-frame img {
    display: block;
    max-width: 100%;
    height: auto;
}
.ms-preview-meta {
    margin-top: 12px;
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    font-family: 'JetBrains Mono', monospace;
}
.ms-preview-size {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
.ms-preview-size.ok { background: rgba(34,197,94,0.2); color: #22c55e; }
.ms-preview-size.warn { background: rgba(245,158,11,0.2); color: #f59e0b; }
.ms-preview-size.over { background: rgba(239,68,68,0.2); color: #ef4444; }

/* Form Fields */
.ms-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ms-field-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #64748b);
}
.ms-input {
    padding: 9px 12px;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-card, #fff);
    color: var(--text-primary, #1e293b);
    transition: border-color 0.2s;
}
.ms-input:focus {
    outline: none;
    border-color: #e85d04;
    box-shadow: 0 0 0 3px rgba(232,93,4,0.1);
}
.ms-select {
    padding: 9px 12px;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-card, #fff);
    color: var(--text-primary, #1e293b);
    cursor: pointer;
}
.ms-textarea {
    min-height: 60px;
    resize: vertical;
    font-family: inherit;
}

/* Template Grid */
.ms-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.ms-template-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    aspect-ratio: 4/3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px;
}
.ms-template-card:hover {
    border-color: #e85d04;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(232,93,4,0.15);
}
.ms-template-card.selected {
    border-color: #e85d04;
    box-shadow: 0 0 0 3px rgba(232,93,4,0.2);
}
.ms-template-name {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    margin-top: 6px;
}
.ms-template-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(232,93,4,0.8);
    color: #fff;
    text-transform: uppercase;
}

/* AI Copy Variants */
.ms-copy-variants {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ms-copy-variant {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-light, #e2e8f0);
    background: var(--bg-card, #fff);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
    transition: all 0.2s;
    line-height: 1.5;
}
.ms-copy-variant:hover { border-color: #e85d04; background: rgba(232,93,4,0.03); }
.ms-copy-variant.selected {
    border-color: #e85d04;
    background: rgba(232,93,4,0.05);
    font-weight: 600;
}
.ms-copy-variant .ms-copy-chars {
    float: right;
    font-size: 10px;
    color: var(--text-secondary, #64748b);
    font-weight: 400;
}

/* Style Pills */
.ms-style-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.ms-style-pill {
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light, #e2e8f0);
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    transition: all 0.2s;
}
.ms-style-pill:hover { border-color: #e85d04; color: #e85d04; }
.ms-style-pill.active { background: rgba(232,93,4,0.08); border-color: #e85d04; color: #e85d04; }

/* Generate Button */
.ms-generate-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #e85d04, #c2410c);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}
.ms-generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232,93,4,0.3);
}
.ms-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.ms-ai-btn {
    padding: 8px 16px;
    border: 1px solid #e85d04;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #e85d04;
    background: rgba(232,93,4,0.05);
    cursor: pointer;
    transition: all 0.2s;
}
.ms-ai-btn:hover { background: rgba(232,93,4,0.1); }
.ms-ai-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Gallery Tab ── */
.ms-gallery-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
}
.ms-gallery-search {
    flex: 1;
    max-width: 300px;
}
.ms-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px 24px;
}
.ms-graphic-card {
    background: var(--bg-card, #fff);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-light, #e2e8f0);
    transition: all 0.2s;
}
.ms-graphic-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.ms-graphic-thumb {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ms-graphic-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ms-graphic-meta {
    padding: 10px 12px;
}
.ms-graphic-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ms-graphic-info {
    font-size: 11px;
    color: var(--text-secondary, #64748b);
    margin-top: 4px;
    display: flex;
    gap: 8px;
}
.ms-graphic-actions {
    display: flex;
    gap: 6px;
    padding: 0 12px 10px;
}
.ms-graphic-actions button {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-light, #e2e8f0);
    background: var(--bg-card, #fff);
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    transition: all 0.2s;
}
.ms-graphic-actions button:hover { border-color: #e85d04; color: #e85d04; }
.ms-graphic-actions button.delete:hover { border-color: #ef4444; color: #ef4444; }

/* Empty State */
.ms-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary, #64748b);
    text-align: center;
    gap: 12px;
    font-size: 14px;
}
.ms-empty svg { width: 48px; height: 48px; fill: var(--text-secondary, #64748b); opacity: 0.3; }

/* Responsive */
@media (max-width: 900px) {
    .ms-tab-content.active { flex-direction: column; }
    .ms-preview-panel { width: 100%; min-width: unset; border-left: none; border-top: 1px solid var(--border-light, #e2e8f0); }
}
