/**
 * Edit Document Page Styles
 * Extracted from resources/views/filament/documents/pages/edit-document.blade.php
 */

.edit-doc-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .edit-doc-layout {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Confidence Section */
.confidence-section {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: center;
    text-align: start;
}

.confidence-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

/* Metadata Section */
.metadata-section {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (min-width: 768px) {
    .metadata-section {
        grid-column: span 4;
    }
}

.metadata-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
}

.dark .metadata-title {
    color: #f3f4f6;
}

.metadata-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .metadata-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .metadata-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.meta-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

.meta-value {
    display: block;
    font-size: 0.875rem;
    color: #111827;
    margin-top: 0.25rem;
}

.dark .meta-value {
    color: #e5e7eb;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uppercase {
    text-transform: uppercase;
}

/* Alert Info */
.info-alert {
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.dark .info-alert {
    background-color: rgba(88, 28, 135, 0.2);
    border-color: rgba(107, 33, 168, 0.5);
}

.info-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: #7c3aed;
}

.dark .info-icon {
    color: #a78bfa;
}

.info-text {
    font-size: 0.875rem;
    color: #5b21b6;
}

.dark .info-text {
    color: #d8b4fe;
}

/* Form */
.form-container {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.dark .form-group label {
    color: #d1d5db;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-input {
    display: block;
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.dark .form-input {
    border-color: rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.disabled-input {
    background-color: #f9fafb;
    color: #6b7280;
    cursor: not-allowed;
}

.dark .disabled-input {
    background-color: rgba(255, 255, 255, 0.05);
    color: #9ca3af;
}

.action-btn {
    padding: 0.5rem;
    border-radius: 9999px;
    transition: color 0.2s, background-color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
}

.action-btn:hover {
    background-color: #f3f4f6;
}

.dark .action-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-check {
    color: #9ca3af;
}

.btn-check.active {
    background-color: #dcfce7;
    color: #16a34a;
}

.btn-cross {
    color: #9ca3af;
}

.btn-cross.active {
    background-color: #fee2e2;
    color: #dc2626;
}

.icon {
    width: 1.5rem;
    height: 1.5rem;
}

/* Footer */
.footer-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2rem;
}

/* Dynamic Data Table */
.dynamic-sections-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dynamic-data-container {
    overflow: hidden;
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.dark .dynamic-data-container {
    border-color: rgba(255, 255, 255, 0.1);
}

.dynamic-data-table {
    width: 100%;
    font-size: 0.875rem;
    text-align: left;
    border-collapse: collapse;
}

.dynamic-data-row {
    transition: background-color 0.15s ease-in-out;
    border-top: 1px solid #e5e7eb;
}

.dynamic-data-row:first-child {
    border-top: none;
}

.dark .dynamic-data-row {
    border-color: rgba(255, 255, 255, 0.1);
}

.dynamic-data-row:hover {
    background-color: #f9fafb;
}

.dark .dynamic-data-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.dynamic-data-key {
    padding: 0.75rem 1rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    width: 33.333333%;
    white-space: nowrap;
}

.dark .dynamic-data-key {
    color: #9ca3af;
}

.dynamic-data-value {
    padding: 0.75rem 1rem;
    color: #111827;
    word-break: break-word;
    width: 66.666667%;
}

.dark .dynamic-data-value {
    color: white;
}

/* Secondary Data Table (Items) */
.secondary-data-container {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.dark .secondary-data-container {
    border-color: rgba(255, 255, 255, 0.1);
}

.secondary-data-table {
    width: 100%;
    font-size: 0.875rem;
    text-align: left;
    color: #6b7280;
}

.dark .secondary-data-table {
    color: #9ca3af;
}

.secondary-data-thead {
    font-size: 0.75rem;
    text-transform: uppercase;
    background-color: #f9fafb;
    color: #374151;
}

.dark .secondary-data-thead {
    background-color: rgba(255, 255, 255, 0.05);
    color: #9ca3af;
}

.secondary-data-th {
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
}

.secondary-data-row {
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.15s ease-in-out;
}

.dark .secondary-data-row {
    background-color: #18181a;
    border-color: rgba(255, 255, 255, 0.1);
}

.secondary-data-row:hover {
    background-color: #f9fafb;
}

.dark .secondary-data-row:hover {
    background-color: #374151;
}

.secondary-data-td {
    padding: 1rem 1.5rem;
    white-space: nowrap;
    color: #111827;
}

.dark .secondary-data-td {
    color: white;
}

/* Responsive Styles (Mobile) */
@media (max-width: 640px) {
    .dynamic-data-row {
        display: flex;
        flex-direction: column;
    }

    .dynamic-data-key {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        background-color: #f9fafb;
        padding: 0.5rem 1rem;
    }

    .dark .dynamic-data-key {
        border-bottom-color: rgba(255, 255, 255, 0.1);
        background-color: rgba(255, 255, 255, 0.05);
    }

    .dynamic-data-value {
        width: 100%;
        padding: 0.75rem 1rem;
    }

    .secondary-data-th,
    .secondary-data-td {
        padding: 0.75rem 1rem;
    }
}

/* Validation Icons Container */
.validation-icons-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    margin-left: 0.5rem;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Dynamic Sections Grid */
.dynamic-sections-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    min-width: 0;
}

/* Flex Utilities for Sections */
.section-flex-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
}

.flex-grow-content {
    flex-grow: 1;
    min-width: 0;
    border-radius: 0.7rem;
    border: 1px solid #d1d5db;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Form Layout Utilities */
.form-main-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
}

.input-align-start {
    align-items: flex-start;
}

.validation-group-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

/* Override Filament Section Defaults */
.filament-section-clean {
    box-shadow: none !important;
    border: none !important;
}

.filament-section-clean .fi-section-content-ctn,
.filament-section-clean>div,
.filament-section-clean {
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
}

/* Section Header Container */
.section-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    flex: 1;
}