/**
 * SBN Rhythm Patterns Admin Styles
 */

/* General */
.sbn-rhythm-patterns-admin h1 {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Empty State */
.sbn-empty-state {
    text-align: center;
    padding: 80px 40px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 20px;
}

.sbn-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.sbn-empty-state h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.sbn-empty-state p {
    color: #646970;
    margin-bottom: 24px;
}

/* Category Headers */
.sbn-category-header {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #50575e;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e85d3b;
}

.sbn-category-header:first-child {
    margin-top: 20px;
}

/* Patterns Grid */
.sbn-patterns-category {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* Pattern Card */
.sbn-pattern-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    transition: box-shadow 0.2s ease;
}

.sbn-pattern-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.sbn-pattern-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.sbn-pattern-header h4 {
    margin: 0;
    font-size: 16px;
    color: #1d2327;
}

.sbn-pattern-slug {
    font-size: 11px;
    background: #f0f0f1;
    padding: 2px 8px;
    border-radius: 3px;
    color: #646970;
}

.sbn-pattern-preview {
    background: #f9f9f9;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
}

.sbn-pattern-info {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #646970;
}

.sbn-pattern-time,
.sbn-pattern-bpm {
    background: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #e5e5e5;
}

.sbn-pattern-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sbn-pattern-grid-row {
    display: flex;
    gap: 3px;
}

.sbn-pattern-grid-label {
    width: 50px;
    font-size: 10px;
    color: #888;
    text-align: right;
    padding-right: 8px;
    line-height: 22px;
}

.sbn-pattern-grid-cell {
    width: 22px;
    height: 22px;
    border: 1px solid #ddd;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #aaa;
    background: #fff;
}

.sbn-pattern-grid-cell.is-measure-start {
    margin-left: 10px;
    position: relative;
}

.sbn-pattern-grid-cell.is-measure-start::before {
    content: '';
    position: absolute;
    left: -6px;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: #ccc;
    border-radius: 1px;
}

.sbn-pattern-grid-cell.is-beat-label.is-measure-start::before {
    top: 0;
    bottom: 0;
}

.sbn-pattern-grid-cell.is-hit {
    background: #fff5f3;
    border-color: #e85d3b;
    color: #e85d3b;
}

.sbn-pattern-grid-cell.is-accent {
    background: #e85d3b;
    border-color: #d04a2a;
    color: #fff;
    font-weight: 700;
}

.sbn-pattern-grid-cell.is-thumb.is-hit {
    background: #f5f5f5;
    border-color: #666;
    color: #333;
}

.sbn-pattern-desc {
    font-size: 13px;
    color: #646970;
    margin: 0 0 12px;
    line-height: 1.4;
}

.sbn-pattern-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.sbn-pattern-shortcode {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e1e1e;
    padding: 8px 12px;
    border-radius: 4px;
}

.sbn-pattern-shortcode code {
    flex: 1;
    font-size: 11px;
    color: #9cdcfe;
    background: none;
    padding: 0;
}

.sbn-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.sbn-copy-btn:hover {
    opacity: 1;
}

/* Editor Layout */
.sbn-pattern-editor {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    margin-top: 20px;
}

@media (max-width: 1200px) {
    .sbn-pattern-editor {
        grid-template-columns: 1fr;
    }
}

.sbn-editor-main,
.sbn-editor-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Panel */
.sbn-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.sbn-panel-header {
    padding: 12px 16px;
    background: #f6f7f7;
    border-bottom: 1px solid #ddd;
}

.sbn-panel-header h2,
.sbn-panel-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #50575e;
}

.sbn-panel-body {
    padding: 20px;
}

/* Form Styles */
.sbn-form-row {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.sbn-form-row-2 {
    grid-template-columns: 1fr 1fr;
}

.sbn-form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 782px) {
    .sbn-form-row-2,
    .sbn-form-row-3 {
        grid-template-columns: 1fr;
    }
}

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

.sbn-form-field label {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
}

.sbn-form-field input,
.sbn-form-field select,
.sbn-form-field textarea {
    padding: 8px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 14px;
}

.sbn-form-field input:focus,
.sbn-form-field select:focus,
.sbn-form-field textarea:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.sbn-form-field .description {
    font-size: 12px;
    color: #646970;
    margin: 0;
}

.sbn-pattern-input {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace !important;
    letter-spacing: 0.1em;
}

/* Pattern Editor Grid */
.sbn-pattern-editor-grid {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.sbn-editor-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.sbn-editor-row:last-child {
    margin-bottom: 0;
}

.sbn-editor-label {
    width: 70px;
    font-size: 12px;
    font-weight: 500;
    color: #50575e;
    text-align: right;
    padding-right: 12px;
}

.sbn-editor-cell {
    width: 32px;
    height: 32px;
    border: 2px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
    background: #fff;
    transition: all 0.15s ease;
    user-select: none;
}

.sbn-editor-cell.is-measure-start {
    margin-left: 12px;
    position: relative;
}

.sbn-editor-cell.is-measure-start::before {
    content: '';
    position: absolute;
    left: -8px;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: #ccc;
    border-radius: 1px;
}

.sbn-editor-cell.is-beat-label.is-measure-start::before {
    top: 0;
    bottom: 0;
}

.sbn-editor-cell:hover {
    border-color: #999;
}

.sbn-editor-cell.is-hit {
    background: #fff5f3;
    border-color: #e85d3b;
    color: #e85d3b;
}

.sbn-editor-cell.is-accent {
    background: #e85d3b;
    border-color: #d04a2a;
    color: #fff;
}

.sbn-editor-cell.is-thumb {
    border-style: dashed;
}

.sbn-editor-cell.is-thumb.is-hit {
    background: #f5f5f5;
    border-color: #666;
    border-style: solid;
    color: #333;
}

.sbn-editor-cell.is-beat-label {
    background: none;
    border: none;
    font-size: 11px;
    color: #999;
    font-weight: 500;
    cursor: default;
}

/* Live Preview */
.sbn-live-preview {
    background: #f9f9f9;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
}

.sbn-live-preview .sbn-pattern-grid {
    margin-top: 0;
}

.sbn-preview-play {
    width: 100%;
}

.sbn-preview-play.is-playing {
    background: #e85d3b;
    border-color: #d04a2a;
    color: #fff;
}

/* Usage Panel */
.sbn-panel-body code {
    display: block;
    background: #1e1e1e;
    color: #9cdcfe;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 12px;
    word-break: break-all;
}

/* Editor Actions */
.sbn-editor-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sbn-editor-actions .button-hero {
    padding: 12px 24px;
    height: auto;
    font-size: 14px;
    text-align: center;
}

/* Toast */
.sbn-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: #1d2327;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    z-index: 100000;
    animation: sbn-toast-in 0.3s ease;
}

.sbn-toast.success {
    background: #00a32a;
}

.sbn-toast.error {
    background: #d63638;
}

@keyframes sbn-toast-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
