/* Component Manager Styles */
#messageComponents {
    background: #1e1f22;
    border-radius: 8px;
    border: 1px solid #3f4147;
    padding: 16px;
    margin-top: 16px;
}

.empty-components {
    text-align: center;
    padding: 32px 16px;
    color: #87898c;
}

.empty-components p {
    font-weight: 600;
    margin-bottom: 8px;
    color: #dcddde;
}

.empty-components small {
    font-size: 0.75rem;
    color: #6d6f78;
}

/* Component Item */
.component-item {
    background: #313338;
    border: 1px solid #3f4147;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.component-item:last-child {
    margin-bottom: 0;
}

.component-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #2b2d31;
    border-bottom: 1px solid #3f4147;
}

.component-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #f2f3f5;
}

.component-icon {
    font-size: 1.2rem;
}

.component-actions {
    display: flex;
    gap: 8px;
}

.component-actions button {
    background: #4e5058;
    color: #f2f3f5;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.component-actions button:hover {
    background: #5c5f66;
}

.add-button-btn,
.add-role-option-btn {
    background: #248046 !important;
}

.add-button-btn:hover,
.add-role-option-btn:hover {
    background: #1a5b33 !important;
}

.remove-component-btn {
    background: #da373c !important;
}

.remove-component-btn:hover {
    background: #c12126 !important;
}

.component-content {
    padding: 16px;
}

/* Button Component Styles */
.buttons-config {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.button-config {
    background: #1e1f22;
    border: 1px solid #3f4147;
    border-radius: 6px;
    padding: 12px;
}

.button-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.button-config-header span {
    font-weight: 600;
    color: #f2f3f5;
    font-size: 0.875rem;
}

.remove-button-btn,
.remove-role-option-btn {
    background: #da373c;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.remove-button-btn:hover,
.remove-role-option-btn:hover {
    background: #c12126;
}

.button-config-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.button-config-fields .form-group:last-child {
    grid-column: 1 / -1;
}

/* Role Select Component Styles */
.select-menu-config {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.role-options h5 {
    color: #f2f3f5;
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.no-options {
    color: #87898c;
    font-style: italic;
    text-align: center;
    padding: 16px;
    background: #1e1f22;
    border-radius: 4px;
    border: 1px dashed #3f4147;
}

.role-option-config {
    background: #1e1f22;
    border: 1px solid #3f4147;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
}

.role-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.role-option-header span {
    font-weight: 600;
    color: #f2f3f5;
    font-size: 0.875rem;
}

.role-option-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.role-option-fields .form-group:nth-child(3),
.role-option-fields .form-group:nth-child(4) {
    grid-column: 1 / -1;
}

/* Form Styles for Components */
.component-item .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.component-item .form-group label {
    font-weight: 600;
    color: #b1b5bc;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.component-item .form-group input,
.component-item .form-group textarea,
.component-item .form-group select {
    background: #313338;
    border: 1px solid #3f4147;
    color: #f2f3f5;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.component-item .form-group input:focus,
.component-item .form-group textarea:focus,
.component-item .form-group select:focus {
    outline: none;
    border-color: #5865f2;
    box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.1);
}

.component-item .form-group input[type="number"] {
    max-width: 100px;
}

/* Component Type Selector Modal */
.component-type-selector h4 {
    color: #f2f3f5;
    font-weight: 600;
    margin-bottom: 16px;
}

.component-type-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.component-type-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #2b2d31;
    border: 1px solid #3f4147;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.component-type-btn:hover {
    background: #313338;
    border-color: #5865f2;
    transform: translateY(-1px);
}

.component-type-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.component-type-info {
    flex: 1;
}

.component-type-name {
    font-weight: 600;
    color: #f2f3f5;
    font-size: 1rem;
    margin-bottom: 4px;
}

.component-type-desc {
    color: #87898c;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Discord Component Preview Styles */
.discord-components {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 520px;
}

.discord-component-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.discord-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #5865f2;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discord-button:hover {
    background: #4752c4;
    text-decoration: none;
    color: #ffffff;
}

.discord-button.link {
    background: transparent;
    color: #00a8fc;
    border: none;
}

.discord-button.link:hover {
    background: rgba(0, 168, 252, 0.1);
    color: #00a8fc;
    text-decoration: underline;
}

.discord-button.light {
    background: #5865f2;
    color: #ffffff;
}

.discord-button.link.light {
    background: transparent;
    color: #0066cc;
}

.discord-button.link.light:hover {
    background: rgba(0, 102, 204, 0.1);
    color: #0066cc;
}

.discord-select-menu {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #1e1f22;
    border: 1px solid #3f4147;
    border-radius: 4px;
    color: #dcddde;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    max-width: 320px;
    min-height: 32px;
}

.discord-select-menu.light {
    background: #f2f3f5;
    border-color: #e3e5e8;
    color: #2e3338;
}

.discord-select-menu:hover {
    border-color: #5865f2;
}

.discord-select-menu-placeholder {
    color: #87898c;
    flex: 1;
}

.discord-select-menu-placeholder.light {
    color: #5c5e66;
}

.discord-select-menu-arrow {
    margin-left: 8px;
    color: #87898c;
    font-size: 12px;
}

.discord-select-menu-arrow.light {
    color: #5c5e66;
}

/* Responsive Design */
@media (max-width: 768px) {
    .button-config-fields,
    .role-option-fields {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .component-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .component-actions {
        justify-content: flex-end;
    }
    
    .component-type-options {
        gap: 8px;
    }
    
    .component-type-btn {
        padding: 12px;
    }
    
    .discord-component-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .discord-button,
    .discord-select-menu {
        max-width: 100%;
        width: 100%;
    }
}

/* Animation for new components */
.component-item.new-component {
    animation: componentSlideIn 0.3s ease-out;
}

@keyframes componentSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Validation States */
.form-group.error input,
.form-group.error textarea,
.form-group.error select {
    border-color: #ed4245;
}

.form-group.error label {
    color: #ed4245;
}

.validation-error {
    color: #ed4245;
    font-size: 0.75rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.validation-error::before {
    content: "⚠";
}

/* Component Limits Warning */
.component-limit-warning {
    background: rgba(250, 166, 26, 0.1);
    border: 1px solid #faa61a;
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 16px;
    color: #faa61a;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.component-limit-warning::before {
    content: "⚠";
    font-size: 1rem;
}