/* ===========================================
   C4-AI - Commands Section - Modern Design
   =========================================== */

/* Page Header */
.commands-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 16px;
    color: white;
}

.commands-page-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.commands-page-header .header-icon {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.commands-page-header .header-icon svg {
    width: 24px;
    height: 24px;
    stroke: white;
    fill: none;
    stroke-width: 2;
}

.commands-page-header p {
    margin: 4px 0 0;
    opacity: 0.9;
    font-size: 14px;
}

/* Filters Bar */
.commands-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.cmd-search-wrapper {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.cmd-search-wrapper svg {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 2;
}

.cmd-search-wrapper input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    font-family: var(--font-family);
    background: var(--card-bg);
    transition: all 0.2s;
}

.cmd-search-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.cmd-filter-select {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    font-family: var(--font-family);
    background: var(--card-bg);
    min-width: 150px;
    cursor: pointer;
    transition: all 0.2s;
}

.cmd-filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-add-command {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-add-command:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-add-command svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Commands Grid */
.commands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Command Card - Modern Style */
.command-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.command-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    opacity: 0;
    transition: opacity 0.3s;
}

.command-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.15);
    transform: translateY(-4px);
}

.command-card:hover::before {
    opacity: 1;
}

.command-card.inactive {
    opacity: 0.6;
}

.command-card.inactive::before {
    background: var(--text-muted);
}

/* Card Header */
.cmd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(to bottom, var(--content-bg), transparent);
}

.cmd-name {
    font-family: 'Fira Code', monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.cmd-type {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--content-bg);
    color: var(--text-secondary);
}

.cmd-type svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.cmd-type.text { color: #10b981; background: rgba(16, 185, 129, 0.1); }
.cmd-type.photo { color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.cmd-type.voice { color: #ec4899; background: rgba(236, 72, 153, 0.1); }
.cmd-type.video { color: #3b82f6; background: rgba(59, 130, 246, 0.1); }
.cmd-type.document { color: #8b5cf6; background: rgba(139, 92, 246, 0.1); }

/* Card Body */
.cmd-body {
    padding: 16px 20px;
    min-height: 80px;
}

.cmd-body p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cmd-body em {
    color: var(--text-muted);
    font-style: normal;
}

.cmd-description {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

/* Card Footer */
.cmd-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--content-bg);
    border-top: 1px solid var(--border-color);
}

.cmd-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
}

.cmd-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.cmd-status.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

/* Card Actions */
.cmd-actions {
    display: flex;
    gap: 8px;
}

.cmd-actions .btn {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
}

.cmd-actions .btn-edit {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.cmd-actions .btn-edit:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.cmd-actions .btn-toggle {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.cmd-actions .btn-toggle:hover {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

.cmd-actions .btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.cmd-actions .btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* Empty State */
.commands-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 40px;
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 20px;
}

.commands-empty svg {
    width: 80px;
    height: 80px;
    stroke: var(--border-color);
    fill: none;
    stroke-width: 1;
    margin-bottom: 20px;
}

.commands-empty h3 {
    font-size: 20px;
    color: var(--text-dark);
    margin: 0 0 8px;
}

.commands-empty p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 24px;
}

/* Loading State */
.commands-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
}

.commands-loading .loader {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.commands-loading p {
    color: var(--text-muted);
    font-size: 14px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Stats Bar */
.commands-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.cmd-stat {
    flex: 1;
    min-width: 150px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.cmd-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cmd-stat-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.cmd-stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.cmd-stat-icon.green { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.cmd-stat-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }

.cmd-stat-info h4 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.cmd-stat-info p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 2px 0 0;
}

/* Responsive */
@media (max-width: 768px) {
    .commands-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .commands-filters {
        flex-direction: column;
    }
    
    .cmd-search-wrapper {
        width: 100%;
    }
    
    .commands-grid {
        grid-template-columns: 1fr;
    }
    
    .cmd-actions {
        flex-wrap: wrap;
    }
    
    .commands-stats {
        flex-direction: column;
    }
}
