/* IDS Editor Styles */

/* Editor Structure */
.ids-structure {
    padding: 20px;
}

.info-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 2px solid #e9ecef;
}

.info-section h3 {
    margin-bottom: 15px;
    color: #2d3748;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.info-grid > div {
    padding: 10px;
    background: white;
    border-radius: 6px;
}

.specifications-container h3 {
    margin-bottom: 20px;
    color: #2d3748;
}

#idsContent .specification-item {
    background: white;
    border: 3px solid #c62828;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#idsContent .spec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#idsContent .spec-header h4 {
    margin: 0;
    color: white;
    font-size: 1.3em;
}

.spec-description {
    color: #6c757d;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

#idsContent .applicability-section,
#idsContent .requirements-section {
    margin-top: 20px;
}

#idsContent .applicability-section h5,
#idsContent .requirements-section h5 {
    margin-bottom: 15px;
    color: white;
    font-size: 1.1em;
}

#idsContent .collapsible-header h5 {
    color: white;
    font-weight: 600;
}

/* Collapsible Sections */
.collapsible-section {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.collapsible-header {
    cursor: pointer;
    padding: 12px 15px;
    background: #1a237e;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
    transition: all 0.2s ease;
    margin: 0 !important;
    font-weight: 600;
}

.collapsible-header:hover {
    background: #0d1656;
}

/* Spec header collapsible */
#idsContent .spec-header.collapsible-header {
    background: #c62828;
    padding: 15px 20px;
    border-radius: 0;
}

#idsContent .spec-header.collapsible-header:hover {
    background: #b71c1c;
}

.collapse-icon {
    font-size: 0.9em;
    transition: transform 0.3s ease;
    display: inline-block;
    width: 20px;
}

.facet-count {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85em;
}

.collapsible-content {
    padding: 15px;
    background: white;
    max-height: 10000px;
    overflow-y: auto;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.specification-item > .collapsible-content {
    padding: 20px;
}

#idsContent .applicability-section.collapsible-section,
#idsContent .requirements-section.collapsible-section {
    border: 3px solid #1a237e;
    box-shadow: 0 2px 6px rgba(26, 35, 126, 0.2);
}

.collapsible-section.collapsed .collapsible-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.collapsible-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

#idsContent .facet-item {
    background: #ffffff;
    border: 2px solid #495057;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    position: relative;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

#idsContent .facet-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

#idsContent .facet-icon {
    font-size: 1.5em;
}

#idsContent .facet-type {
    font-weight: 700;
    color: #1a237e;
    text-transform: uppercase;
    font-size: 0.9em;
}

#idsContent .facet-details {
    padding-left: 45px;
}

#idsContent .facet-details > div {
    padding: 5px 0;
    color: #495057;
}

#idsContent .facet-details strong {
    color: #2d3748;
    margin-right: 8px;
}

#idsContent .facet-details code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.empty-message {
    color: #6c757d;
    font-style: italic;
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 6px;
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

/* Modal Container */
.modal-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1200px;
    width: 95%;
    max-height: 95vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 30px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.6em;
    font-weight: 600;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5em;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal Body */
.modal-body {
    padding: 30px;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.95em;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: 'Courier New', monospace;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 0.85em;
}

/* Radio/Checkbox Groups */
.radio-group,
.checkbox-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.radio-option,
.checkbox-option {
    display: flex;
    align-items: center;
    gap: 6px;
}

.radio-option input,
.checkbox-option input {
    width: auto;
    margin: 0;
}

/* Conditional Fields */
.conditional-field {
    display: none;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    margin-top: 10px;
}

.conditional-field.active {
    display: block;
}

/* Modal Footer */
.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Edit Mode Styles */
.edit-mode .applicability-item,
.edit-mode .requirement-item {
    position: relative;
    padding-right: 80px;
}

.edit-controls {
    display: none;
    gap: 5px;
}

.edit-mode .edit-controls {
    display: flex;
}

.spec-header .edit-controls {
    position: static;
}

.edit-btn,
.delete-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.2s;
}

.edit-btn {
    background: #667eea;
    color: white;
}

.edit-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.delete-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Add Buttons in Edit Mode */
.add-facet-btn {
    display: none;
    margin-top: 15px;
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.edit-mode .add-facet-btn {
    display: inline-block;
}

.add-facet-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Facet Type Selector */
.facet-type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.facet-type-card {
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.facet-type-card:hover {
    border-color: #667eea;
    background: #f8f9fa;
    transform: translateY(-2px);
}

.facet-type-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.facet-type-icon {
    font-size: 2em;
    margin-bottom: 8px;
}

.facet-type-name {
    font-weight: 600;
    font-size: 0.9em;
}

/* Restriction Types */
.restriction-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.restriction-type-btn {
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    transition: all 0.2s;
}

.restriction-type-btn:hover {
    border-color: #667eea;
}

.restriction-type-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* Enumeration List */
.enumeration-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.enumeration-item {
    display: flex;
    gap: 10px;
}

.enumeration-item input {
    flex: 1;
}

.enumeration-item button {
    padding: 10px 15px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.enumeration-item button:hover {
    background: #c82333;
}

.add-enum-btn {
    margin-top: 10px;
    padding: 8px 15px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.add-enum-btn:hover {
    background: #218838;
}

/* Bounds Inputs */
.bounds-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Success/Error Messages */
.message-box {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
}

.message-box.success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.message-box.error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* Collapse Controls */
.collapse-controls {
    display: flex;
    gap: 10px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9em;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
    }

    .modal-body {
        padding: 20px;
    }

    .facet-type-selector {
        grid-template-columns: repeat(2, 1fr);
    }

    .restriction-types {
        grid-template-columns: 1fr;
    }

    .bounds-inputs {
        grid-template-columns: 1fr;
    }
}
