/**
 * Code Snippets Manager - Admin Styles
 *
 * @package Switchboard
 * @since 1.0.0
 */

/* ===================================
   Dashboard View - List Layout
   =================================== */

/* Dashboard Layout */
.csm-dashboard-layout {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-top: 24px;
}

/* List Column */
.csm-list-column {
    grid-column: span 3;
    display: flex;
    flex-direction: column;
    gap: 16px;
}


/* Snippets List */
.csm-snippets-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Snippet Row */
.csm-snippet-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.csm-snippet-row[data-status="active"] {
    background: var(--primary-50);
    border-color: var(--primary-500);
}

.csm-snippet-row:hover {
    border-color: var(--primary-500);
    background: var(--primary-50);
    box-shadow: 0 2px 8px rgba(var(--primary-500-rgb), 0.1);
}

.csm-snippet-row[data-status="active"]:hover {
    background: var(--primary-100);
    border-color: var(--primary-600);
}

.csm-snippet-row-main {
    flex: 1;
    min-width: 0;
}

.csm-snippet-row-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.csm-snippet-row-title-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.csm-snippet-row-title {
    font-size: 16px;
    font-weight: 500;
    color: #0f172a;
    text-decoration: none;
    transition: color 0.2s ease;
}

.csm-snippet-row-title:hover {
    color: var(--primary-500);
}

.csm-snippet-row-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: #94a3b8;
}

.csm-snippet-row-priority,
.csm-snippet-row-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.csm-snippet-row-priority .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.csm-snippet-row-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.csm-snippet-row-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.csm-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.csm-badge-js {
    background: #fef3c7;
    color: #92400e;
}

.csm-badge-css {
    background: #dbeafe;
    color: #1e40af;
}

.csm-badge-html {
    background: #fce7f3;
    color: #9f1239;
}

.csm-badge-location {
    background: var(--gray-100);
    color: var(--gray-600);
}

.csm-snippet-row-desc {
    font-size: 14px;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

.csm-status-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.csm-status-active {
    background: var(--primary-100);
    color: var(--primary-800);
}

.csm-status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.csm-snippet-row-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
}

.csm-snippet-row:hover .csm-snippet-row-edit {
    opacity: 1;
    visibility: visible;
}

.csm-snippet-row-edit .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #64748b;
}

.csm-snippet-row-edit:hover {
    background: var(--primary-500);
}

.csm-snippet-row-edit:hover .dashicons {
    color: white;
}

/* Snippet Toggle */
.csm-snippet-toggle {
    flex-shrink: 0;
    margin: 0;
}

.csm-snippet-toggle input[type="checkbox"]:disabled + .sb-module-toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* No Results */
.csm-no-results {
    padding: 60px 20px;
    text-align: center;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}

.csm-no-results p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

/* Filters Column */
.csm-filters-column {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.csm-filter-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 20px;
}

.csm-filter-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Filter Options - List Style */
.csm-filter-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.csm-filter-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #475569;
    font-weight: 500;
    background: white;
}

.csm-filter-option input {
    display: none;
}

.csm-filter-option:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.csm-filter-option.active {
    background: var(--primary-100);
    border-color: var(--primary-500);
    color: var(--primary-700);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(var(--primary-500-rgb), 0.1);
}

/* Empty State */
.csm-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 40px;
    background: white;
    border-radius: 12px;
    margin-top: 24px;
}

.csm-empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-50);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.csm-empty-state-icon svg {
    width: 40px;
    height: 40px;
    color: var(--primary-500);
}

.csm-empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.csm-empty-state-desc {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 24px 0;
    line-height: 1.6;
}

.csm-empty-state-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--primary-500);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.csm-empty-state-btn:hover {
    background: var(--primary-600);
    color: white;
}

.csm-empty-state-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Use Cases Grid in Empty State */
.csm-use-cases-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 32px 0;
    width: 100%;
    max-width: 900px;
}

.csm-use-case-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    text-align: left;
    transition: all 0.2s ease;
}

.csm-use-case-card:hover {
    border-color: var(--primary-500);
    background: var(--primary-50);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-500-rgb), 0.1);
}

.csm-use-case-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.csm-use-case-desc {
    font-size: 12px;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* ===================================
   Edit View - Snippet Editor
   =================================== */

.sb-module-csm-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Editor Layout - Big Col + Small Col */
.csm-editor-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}

.csm-editor-column {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.csm-meta-column {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Code Editor */
.csm-code-editor {
    width: 100%;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 16px;
    border: 1px solid var(--primary-100);
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
    resize: vertical;
    min-height: 400px;
    transition: all 0.2s ease;
}

.csm-code-editor:focus {
    outline: none;
    border-color: var(--primary-500);
    background: white;
    box-shadow: 0 0 0 3px rgba(var(--primary-500-rgb), 0.1);
}

.csm-editor-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: #dbeafe;
    border-left: 4px solid var(--primary-500);
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #1e40af;
}

.csm-editor-notice .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: var(--primary-500);
    flex-shrink: 0;
    margin-top: 1px;
}

/* Meta Toggle - Active Section */
.csm-meta-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.csm-meta-toggle-content {
    flex: 1;
}

.csm-meta-toggle-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 4px 0;
    display: block;
}

.csm-meta-toggle-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
}


/* Responsive */
@media (max-width: 1400px) {
    .csm-dashboard-layout {
        grid-template-columns: 2fr 1fr;
    }

    .csm-list-column {
        grid-column: span 1;
    }

    .csm-filters-column {
        grid-column: span 1;
    }
}

@media (max-width: 1024px) {
    .csm-use-cases-grid {
        grid-template-columns: 1fr;
    }

    .csm-editor-layout {
        grid-template-columns: 1fr;
    }

    .csm-editor-column,
    .csm-meta-column {
        grid-column: span 1;
    }
}

@media (max-width: 900px) {
    .csm-dashboard-layout {
        grid-template-columns: 1fr;
    }

    .csm-list-column {
        grid-column: span 1;
    }

    .csm-filters-column {
        grid-column: span 1;
        order: -1;
    }
}

@media (max-width: 640px) {
    .csm-snippet-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .csm-snippet-row-right {
        flex-direction: row;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .csm-snippet-row-badges {
        order: -1;
        width: 100%;
        margin-bottom: 8px;
    }
}
