/**
 * Truenorth OneDrive Viewer - Frontend Styles
 */

.tn-onedrive-viewer {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

/* Document Embed Styles */
.tn-onedrive-document-embed {
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tn-document-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.tn-document-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.tn-download-document {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: #4CAF50;
    color: white !important;
    text-decoration: none !important;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
    border: none;
    cursor: pointer;
}

.tn-download-document:hover {
    background: #45a049;
}

.tn-download-document .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.tn-document-viewer {
    width: 100%;
    min-height: 600px;
    background: #fff;
}

.tn-document-viewer iframe {
    width: 100%;
    height: 80vh;
    min-height: 600px;
    border: none;
}

.tn-document-viewer.tn-image-viewer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    min-height: auto;
}

.tn-document-viewer.tn-image-viewer img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.tn-document-preview {
    text-align: center;
    padding: 60px 20px;
}

.tn-file-icon-large {
    font-size: 80px;
    margin-bottom: 20px;
}

.tn-document-preview .tn-file-size {
    color: #757575;
    margin: 10px 0 20px;
}

.tn-document-preview .button-primary {
    background: #2196F3;
    border-color: #1976D2;
}

.tn-document-preview .button-primary:hover {
    background: #1976D2;
}

.tn-onedrive-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.tn-onedrive-grid[data-columns="1"] { grid-template-columns: repeat(1, 1fr); }
.tn-onedrive-grid[data-columns="2"] { grid-template-columns: repeat(2, 1fr); }
.tn-onedrive-grid[data-columns="3"] { grid-template-columns: repeat(3, 1fr); }
.tn-onedrive-grid[data-columns="4"] { grid-template-columns: repeat(4, 1fr); }
.tn-onedrive-grid[data-columns="5"] { grid-template-columns: repeat(5, 1fr); }
.tn-onedrive-grid[data-columns="6"] { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 1200px) {
    .tn-onedrive-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .tn-onedrive-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .tn-onedrive-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }
}

.tn-file-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tn-file-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: #4CAF50;
}

.tn-file-icon {
    font-size: 48px;
    margin-bottom: 15px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tn-icon-folder { color: #FFA726; }
.tn-icon-pdf { color: #F44336; }
.tn-icon-word { color: #2196F3; }
.tn-icon-excel { color: #4CAF50; }
.tn-icon-powerpoint { color: #FF5722; }
.tn-icon-image { color: #9C27B0; }
.tn-icon-video { color: #E91E63; }
.tn-icon-audio { color: #00BCD4; }
.tn-icon-archive { color: #795548; }
.tn-icon-code { color: #607D8B; }
.tn-icon-text { color: #9E9E9E; }
.tn-icon-file { color: #757575; }

.tn-file-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tn-file-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 2.8em;
}

.tn-file-size,
.tn-file-date {
    font-size: 12px;
    color: #757575;
}

.tn-file-actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.tn-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: #4CAF50;
    color: white !important;
    text-decoration: none !important;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.tn-download-btn:hover {
    background: #45a049;
}

.tn-download-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.tn-empty-folder {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.tn-empty-folder .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    margin-bottom: 15px;
}

.tn-empty-folder p {
    font-size: 16px;
    margin: 0;
}

.tn-onedrive-error {
    background: #ffebee;
    border: 1px solid #ef5350;
    border-radius: 4px;
    padding: 15px;
    color: #c62828;
    margin: 20px 0;
}

.tn-onedrive-error p {
    margin: 0;
}

/* Folder specific styling */
.tn-folder {
    background: #f5f5f5;
}

.tn-folder:hover {
    background: #eeeeee;
}

/* Loading spinner */
.tn-loading {
    text-align: center;
    padding: 40px;
}

.tn-loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: tn-spin 1s linear infinite;
}

@keyframes tn-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Breadcrumb navigation */
.tn-breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 15px;
}

.tn-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.tn-back-btn:hover {
    background: #1976D2;
}

.tn-back-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.tn-current-path {
    font-size: 13px;
    color: #666;
    font-family: monospace;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 3px;
}

/* Open folder button */
.tn-open-folder-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: #FF9800;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
    width: 100%;
    justify-content: center;
}

.tn-open-folder-btn:hover {
    background: #F57C00;
}

.tn-open-folder-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Enhanced folder styling */
.tn-folder {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFE0B2 100%);
    border-color: #FFB74D;
}

.tn-folder:hover {
    background: linear-gradient(135deg, #FFE0B2 0%, #FFCC80 100%);
    border-color: #FF9800;
}

/* Loading spinner */
.tn-loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    font-size: 16px;
    color: #666;
}

.tn-loading-spinner .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    animation: tn-spin 1s linear infinite;
}

.tn-onedrive-viewer.tn-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Toolbar */
.tn-toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.tn-search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
    display: flex;
    align-items: center;
}

.tn-search-box .dashicons-search {
    position: absolute;
    left: 12px;
    color: #999;
    pointer-events: none;
}

.tn-search-input {
    width: 100%;
    padding: 8px 35px 8px 35px;
    margin-left: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.tn-search-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.tn-clear-search {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tn-clear-search:hover {
    color: #333;
}

.tn-clear-search .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.tn-sort-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tn-sort-box label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #666;
    margin: 0;
    white-space: nowrap;
}

.tn-sort-box .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.tn-sort-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    background: white;
    transition: border-color 0.3s ease;
}

.tn-sort-select:focus {
    outline: none;
    border-color: #4CAF50;
}

.tn-view-toggle {
    display: flex;
    gap: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.tn-view-btn {
    padding: 8px 12px;
    background: white;
    border: none;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
}

.tn-view-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.tn-view-btn.active {
    background: #4CAF50;
    color: white;
}

.tn-view-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.tn-results-info {
    padding: 8px 15px;
    background: #E3F2FD;
    border: 1px solid #90CAF9;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #1565C0;
}

/* List view */
.tn-onedrive-grid.tn-list-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tn-onedrive-grid.tn-list-view .tn-file-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 12px 15px;
    text-align: left;
}

.tn-onedrive-grid.tn-list-view .tn-file-icon {
    font-size: 32px;
    height: auto;
    margin-bottom: 0;
    margin-right: 15px;
    min-width: 40px;
}

.tn-onedrive-grid.tn-list-view .tn-file-info {
    flex: 1;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.tn-onedrive-grid.tn-list-view .tn-file-name {
    flex: 1;
    min-height: auto;
    -webkit-line-clamp: 1;
}

.tn-onedrive-grid.tn-list-view .tn-file-size,
.tn-onedrive-grid.tn-list-view .tn-file-date {
    min-width: 100px;
}

.tn-onedrive-grid.tn-list-view .tn-file-actions {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    margin-left: auto;
}

/* Empty search state */
.tn-empty-search {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    grid-column: 1 / -1;
}

.tn-empty-search .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    margin-bottom: 15px;
}

.tn-empty-search p {
    font-size: 16px;
    margin: 0;
}

/* Responsive toolbar */
@media (max-width: 768px) {
    .tn-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tn-search-box {
        min-width: 100%;
    }
    
    .tn-sort-box {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tn-sort-select {
        width: 100%;
    }
    
    .tn-view-toggle {
        align-self: center;
    }
}
