/* File Repository Manager - Frontend Styles */
/* v0.0.35 REFACTOR - Cleaned up duplicate classes and fixed preview cutoff issues */

/* v2.1.3 ADD START - Sidebar Layout and Navigation */
.frm-page-layout {
    display: flex;
    gap: 20px;
    width: 100%;
}

.frm-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.frm-main-content {
    flex: 1;
    min-width: 0;
}

.frm-sidebar-nav {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: sticky;
    top: 20px;
}

.frm-sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.frm-sidebar-menu li {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #e1e5e9;
}

.frm-sidebar-menu li:last-child {
    border-bottom: none;
}

.frm-sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
}

.frm-sidebar-menu li a .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.frm-sidebar-menu li a:hover {
    background: #f8f9fa;
    color: #0073aa;
}

.frm-sidebar-menu li a.active {
    background: #0073aa;
    color: white;
}

.frm-sidebar-menu li a.active .dashicons {
    color: white;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .frm-page-layout {
        flex-direction: column;
    }

    .frm-sidebar {
        width: 100%;
        position: relative;
    }

    .frm-sidebar-nav {
        position: static;
    }

    .frm-sidebar-menu {
        display: flex;
        overflow-x: auto;
    }

    .frm-sidebar-menu li {
        border-bottom: none;
        border-right: 1px solid #e1e5e9;
        flex: 1;
        min-width: 120px;
    }

    .frm-sidebar-menu li:last-child {
        border-right: none;
    }

    .frm-sidebar-menu li a {
        flex-direction: column;
        text-align: center;
        padding: 12px 15px;
        gap: 5px;
    }
}
/* v2.1.3 ADD END */

/* v0.0.6 ADD START - Auto-upload Layout */
/* v0.0.23 FIX START - Upload Container uses full width */
.frm-upload-container {
    width: 100%;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}
/* v0.0.23 FIX END */

/* File Selection Phase */
.frm-upload-phase {
    margin-bottom: 30px;
}

.frm-file-drop-zone {
    border: 2px dashed #0073aa;
    border-radius: 10px;
    padding: 60px 20px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.frm-file-drop-zone:hover,
.frm-file-drop-zone.frm-drag-over {
    border-color: #005a87;
    background: #e8f4fd;
    transform: translateY(-2px);
}

.frm-drop-zone-content {
    max-width: 400px;
    margin: 0 auto;
}

.frm-drop-icon {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.7;
}

.frm-drop-zone-content h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.frm-drop-zone-content p {
    margin: 0 0 25px 0;
    color: #666;
    font-size: 16px;
}

.frm-select-file-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-bottom: 15px;
}

.frm-select-file-btn:hover {
    background: #005a87;
}

/* Preview Phase */
.frm-preview-phase {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.frm-preview-layout {
    display: flex;
    min-height: 700px;
}

/* v0.0.23 FIX START - Preview section takes 70% of width */
.frm-preview-section {
    flex: 0 0 70%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e1e5e9;
    overflow: hidden;
}
/* v0.0.23 FIX END */

.frm-metadata-section {
    width: 350px;
    padding: 20px;
    background: #f8f9fa;
    overflow-y: auto;
}

.frm-preview-header,
.frm-metadata-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px 20px 15px 20px;
    border-bottom: 1px solid #e1e5e9;
    flex-shrink: 0;
}

.frm-preview-header h4,
.frm-metadata-header h4 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.frm-change-file-btn {
    background: #666;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.frm-change-file-btn:hover {
    background: #555;
}

/* v0.0.35 REFACTOR - File preview container with proper sizing */
.frm-file-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    margin: 0 20px 20px 20px;
}

/* v0.0.35 REFACTOR - Image and PDF containers with flexbox */
.frm-image-container,
.frm-pdf-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* v0.0.35 REFACTOR - Image wrapper with proper sizing */
.frm-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 20px;
}

.frm-zoomable-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    transform-origin: top left;
}

/* v0.0.38 REMOVE - Removed magnify mode class */

/* v0.0.35 REFACTOR - PDF wrapper and frame with proper sizing */
.frm-pdf-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.frm-zoomable-pdf {
    flex: 1;
    width: 100%;
    border: none;
}

.frm-preview-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 16px;
}

/* v0.0.35 REFACTOR - Zoom Controls */
.frm-zoom-controls {
    display: flex !important;
    gap: 6px !important;
}

/* Template-based zoom controls */
.frm-zoom-controls-container {
    padding: 10px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    flex-shrink: 0;
}

.frm-zoom-controls-container .frm-zoom-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    border: none !important;
    transition: all 0.2s ease;
    line-height: 1;
}

.frm-zoom-controls-container .frm-zoom-btn:hover {
    transform: scale(1.1) !important;
    opacity: 0.9 !important;
}

.frm-zoom-controls-container .frm-zoom-btn:active {
    transform: scale(0.95) !important;
}

/* v0.0.38 REMOVE - Removed magnifying glass CSS */

/* Fullscreen Modal */
.frm-fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.frm-fullscreen-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.frm-fullscreen-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.frm-fullscreen-close:hover {
    background: rgba(0, 0, 0, 0.9);
}

.frm-fullscreen-title {
    background: #f8f9fa;
    padding: 15px 20px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e1e5e9;
}

.frm-fullscreen-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f8f9fa;
}

.frm-fullscreen-media img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.frm-fullscreen-media iframe {
    width: 80vw;
    height: 70vh;
    border: none;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Metadata Section */
.frm-file-info {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.frm-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* v0.0.39 FIX - Made buttons smaller */
/* v0.0.40 FIX - Reduced padding and centered text */
.frm-save-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.frm-save-btn:hover {
    background: #005a87;
}

.frm-cancel-btn {
    background: #666;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.frm-cancel-btn:hover {
    background: #555;
}

/* Upload Progress Overlay */
.frm-upload-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.frm-progress-content {
    background: white;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    min-width: 300px;
}

.frm-progress-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.frm-progress-content h4 {
    margin: 0 0 20px 0;
    color: #333;
}

/* v0.0.6 ADD END */

/* Upload Form Styles */
.frm-upload-form-container {
    max-width: 600px;
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.frm-upload-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.frm-form-group {
    display: flex;
    flex-direction: column;
}

.frm-form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.frm-form-group input,
.frm-form-group textarea,
.frm-form-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.frm-form-group input:focus,
.frm-form-group textarea:focus,
.frm-form-group select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.frm-help-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* File Input Styling */
#frm-file-input {
    padding: 15px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s ease;
}

#frm-file-input:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.frm-drag-over #frm-file-input {
    border-color: #0073aa;
    background: #e6f3ff;
}

/* Mobile File Input */
.frm-mobile-device #frm-file-input {
    padding: 20px;
    text-align: center;
    font-size: 16px;
}

/* Submit Button */
.frm-submit-btn {
    background: #0073aa;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    position: relative;
}

.frm-submit-btn:hover:not(:disabled) {
    background: #005a87;
}

.frm-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Progress Bar */
.frm-progress-container {
    margin-top: 10px;
}

.frm-progress-bar {
    width: 100%;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
}

.frm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #00a0d2);
    transition: width 0.3s ease;
    border-radius: 10px;
}

.frm-progress-text {
    text-align: center;
    font-size: 12px;
    color: #666;
}

/* Alert Messages */
.frm-alert {
    padding: 12px;
    border-radius: 4px;
    margin-top: 15px;
    font-weight: 500;
}

.frm-alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.frm-alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Image Preview */
.frm-image-preview {
    margin-top: 10px;
    text-align: center;
}

.frm-remove-preview {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

/* Mobile Camera Help */
.frm-mobile-camera-help {
    margin-top: 20px;
    padding: 15px;
    background: #e6f3ff;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
    display: none;
}

.frm-mobile-camera-help h4 {
    margin: 0 0 10px 0;
    color: #0073aa;
}

.frm-mobile-camera-help ul {
    margin: 0;
    padding-left: 20px;
}

.frm-mobile-camera-help li {
    margin-bottom: 5px;
    font-size: 14px;
}

/* File List Styles */
.frm-file-list-container {
    margin: 20px 0;
}

.frm-no-files {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

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

.frm-file-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.frm-file-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.frm-file-item .frm-file-preview {
    height: 200px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    border: none;
    border-radius: 0;
}

.frm-file-item .frm-file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.frm-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #e9ecef;
}

.frm-file-type {
    font-size: 24px;
    font-weight: bold;
    color: #6c757d;
    padding: 20px;
    border: 2px solid #6c757d;
    border-radius: 8px;
}

.frm-file-item .frm-file-info {
    padding: 15px;
    background: transparent;
    border: none;
    margin: 0;
}

.frm-file-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    line-height: 1.4;
}

.frm-file-title a {
    color: #333;
    text-decoration: none;
}

.frm-file-title a:hover {
    color: #0073aa;
}

.frm-file-description {
    color: #666;
    font-size: 14px;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.frm-file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
}

.frm-file-size,
.frm-file-date,
.frm-file-author,
.frm-file-supplier,
.frm-file-receipt-date,
.frm-file-amount {
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 12px;
}

.frm-file-amount {
    background: #d4edda;
    color: #155724;
    font-weight: 600;
}

.frm-category-badge {
    background: #0073aa;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
}

.frm-file-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 10px 0;
}

.frm-tag {
    background: #e9ecef;
    color: #495057;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.frm-file-actions {
    display: flex;
    gap: 10px;
}

.frm-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.frm-btn-primary {
    background: #0073aa;
    color: white;
}

.frm-btn-primary:hover {
    background: #005a87;
    color: white;
}

.frm-btn-secondary {
    background: #6c757d;
    color: white;
}

.frm-btn-secondary:hover {
    background: #545b62;
    color: white;
}

.frm-btn-small {
    padding: 5px 10px;
    font-size: 11px;
}

/* User Files Styles */
.frm-user-files-container {
    margin: 20px 0;
}

.frm-user-stats {
    margin-bottom: 30px;
}

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

.frm-stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.frm-stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 5px;
}

.frm-stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
}

/* Filter Tabs */
.frm-filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.frm-filter-tab {
    padding: 10px 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.frm-filter-tab:hover {
    background: #e9ecef;
}

.frm-filter-tab.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

/* User File List */
.frm-user-file-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.frm-user-file-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    gap: 20px;
    transition: all 0.3s ease;
}

.frm-user-file-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.frm-file-thumbnail {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.frm-file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.frm-file-icon-large {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #e9ecef;
}

.frm-file-type-large {
    font-size: 18px;
    font-weight: bold;
    color: #6c757d;
}

.frm-file-details {
    flex: 1;
    min-width: 0;
}

.frm-file-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.frm-file-name {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    word-break: break-word;
}

.frm-status-badge {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.frm-status-pending {
    background: #fff3cd;
    color: #856404;
}

.frm-status-approved {
    background: #d4edda;
    color: #155724;
}

.frm-status-rejected {
    background: #f8d7da;
    color: #721c24;
}

.frm-status-archived {
    background: #e2e3e5;
    color: #41464b;
}

.frm-file-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 15px 0;
    font-size: 14px;
}

.frm-meta-item {
    color: #666;
}

.frm-meta-item strong {
    color: #333;
}

.frm-pending-note,
.frm-rejected-note {
    font-size: 12px;
    font-style: italic;
    margin-left: 10px;
}

.frm-pending-note {
    color: #856404;
}

.frm-rejected-note {
    color: #721c24;
}

/* Empty State */
.frm-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.frm-empty-state h3 {
    margin: 0 0 10px 0;
    color: #666;
}

.frm-empty-state p {
    color: #999;
    margin-bottom: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .frm-upload-form-container {
        margin: 10px 0;
        padding: 15px;
    }

    .frm-preview-layout {
        flex-direction: column;
        min-height: 500px;
    }

    .frm-preview-section {
        flex: 1;
        border-right: none;
        border-bottom: 1px solid #e1e5e9;
    }

    .frm-metadata-section {
        width: 100%;
    }

    .frm-form-actions {
        flex-direction: column;
    }

    .frm-file-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .frm-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .frm-user-file-item {
        flex-direction: column;
        padding: 15px;
    }

    .frm-file-thumbnail {
        width: 100%;
        height: 200px;
    }

    .frm-filter-tabs {
        justify-content: center;
    }

    .frm-filter-tab {
        flex: 1;
        text-align: center;
        min-width: 80px;
    }

    .frm-file-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .frm-fullscreen-media iframe {
        width: 95vw;
        height: 60vh;
    }

    .frm-zoom-controls-container .frm-zoom-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 16px !important;
    }
}

@media (max-width: 480px) {
    .frm-stats-grid {
        grid-template-columns: 1fr;
    }

    .frm-file-metadata {
        grid-template-columns: 1fr;
    }

    .frm-file-actions {
        flex-direction: column;
    }

    .frm-filter-tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    .frm-zoom-controls-container .frm-zoom-btn {
        width: 30px !important;
        height: 30px !important;
        font-size: 14px !important;
    }
}