/* Documents Management CSS */
.documents-page {
    direction: rtl;
    text-align: right;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid #dee2e6;
}

.entity-card {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.entity-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.entity-card-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 1rem;
    position: relative;
}

.entity-card-body {
    padding: 1.5rem;
}

.document-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    border: 3px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.document-badge.warning {
    background: #ffc107;
}

.document-badge.danger {
    background: #dc3545;
}

.document-badge.secondary {
    background: #6c757d;
}

.entities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.entity-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.entity-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0;
}

.entity-details {
    font-size: 0.9rem;
    opacity: 0.8;
}

.entity-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #007bff;
}

.stat-label {
    font-size: 0.8rem;
    color: #6c757d;
}

.search-controls {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.search-input {
    border-radius: 25px;
    border: 1px solid #dee2e6;
    padding: 0.5rem 1rem;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

.loading-text {
    color: #6c757d;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Upload Modal Styles */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8f9fa;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #007bff;
    background: #e3f2fd;
}

.upload-area.dragover {
    border-color: #007bff;
    background: #e3f2fd;
    transform: scale(1.02);
}

.upload-content h5 {
    color: #495057;
    margin-bottom: 1rem;
}

.files-preview {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border: 1px solid #dee2e6;
}

.file-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    margin-left: 0.75rem;
}

.file-icon.pdf { background: #dc3545; color: white; }
.file-icon.image { background: #17a2b8; color: white; }
.file-icon.document { background: #007bff; color: white; }
.file-icon.spreadsheet { background: #28a745; color: white; }

.file-details h6 {
    margin: 0;
    font-size: 0.9rem;
}

.file-size {
    font-size: 0.8rem;
    color: #6c757d;
}

.file-status {
    margin-right: 0.75rem;
}

.file-status.valid {
    color: #28a745;
}

.file-status.invalid {
    color: #dc3545;
}

.upload-progress {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.metadata-form {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

/* Animation for file upload */
@keyframes uploadPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.uploading {
    animation: uploadPulse 2s infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .entities-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .search-controls {
        padding: 0.75rem;
    }
    
    .filter-buttons {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .entities-grid {
        grid-template-columns: 1fr;
    }
    
    .entity-card {
        margin-bottom: 1rem;
    }
}

/* Date picker validation styles */
.date-expired {
    border-color: #dc3545 !important;
    background-color: #f8d7da;
}

.date-valid {
    border-color: #28a745 !important;
    background-color: #d4edda;
}

/* Date input enhancements */
input[type="date"] {
    position: relative;
    padding: 0.375rem 0.75rem;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(0.5);
}

input[type="date"]:focus::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
}

/* Company Cards Styles */
.company-documents-section {
    padding: 2rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.section-description {
    color: #6c757d;
    font-size: 1rem;
    margin: 0;
}

.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

.company-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.company-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.company-card-header {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.company-logo {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 1rem;
}

.company-logo i {
    font-size: 1.5rem;
    color: white;
}

.company-info h6 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: bold;
}

.company-type {
    margin: 0.25rem 0 0 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.company-card-body {
    padding: 1.5rem;
}

.document-stats {
    display: flex;
    justify-content: space-between;
    text-align: center;
}

.stat-item {
    flex: 1;
    padding: 0 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

.company-card-footer {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e9ecef;
}

.last-updated {
    font-size: 0.85rem;
    color: #6c757d;
}

.company-card-footer i {
    color: #007bff;
    font-size: 0.9rem;
}

/* Company Documents Page */
.company-documents-page {
    direction: rtl;
    text-align: right;
}

.company-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
}

.company-title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.company-subtitle {
    opacity: 0.9;
    margin: 0;
}

.back-button {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.back-button:hover {
    background: rgba(255,255,255,0.3);
    color: white;
    text-decoration: none;
}

@media (max-width: 768px) {
    .companies-grid {
        grid-template-columns: 1fr;
        padding: 0.5rem;
    }
    
    .company-card-header {
        padding: 1rem;
    }
    
    .company-logo {
        width: 50px;
        height: 50px;
        margin-left: 0.75rem;
    }
    
    .company-logo i {
        font-size: 1.25rem;
    }
}
