/* 
  This file contains the styles for the React-based Dropbox Review Studio.
  It implements the application's glassmorphic design theme.
*/

/* --- Base & Layout --- */

.assignments-container {
    background: var(--surface-color);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-ambient);
    width: 100%;
    max-width: 72rem; /* max-w-6xl */
    height: 90vh;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
}

#root {
    padding: 1.5rem;
}

/* --- Login Screen --- */
.login-screen-container {
    text-align: center;
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-ambient);
    margin: auto;
}
.login-screen-container h1 {
    font-size: 1.875rem; /* text-3xl */
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.login-screen-container p {
    color: var(--text-color-secondary);
    margin-bottom: 1.5rem;
}

/* --- Header --- */
.assignments-react-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.assignments-react-header .header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.assignments-react-header .header-title span {
    font-size: 1.25rem;
    font-weight: 700;
}
.assignments-react-header .header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.assignments-react-header .account-info {
    text-align: right;
}
.assignments-react-header .account-info .display-name {
    font-size: 0.875rem;
    font-weight: 600;
}
.assignments-react-header .account-info .email {
    font-size: 0.75rem;
    color: var(--text-color-secondary);
}

/* --- View As Dropdown --- */
.view-as-dropdown-container {
    position: relative;
}
.view-as-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    background: var(--surface-color-inset);
    color: var(--text-color);
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: background-color 0.2s;
}
.view-as-trigger:hover {
    background: var(--surface-color);
}
.view-as-trigger .label {
    color: var(--text-color-secondary);
}
.view-as-trigger .value {
    font-weight: 600;
}
.view-as-trigger svg {
    width: 0.75rem;
    height: 0.75rem;
}
.view-as-dropdown {
    position: absolute;
    right: 0;
    margin-top: 0.5rem;
    width: 16rem; /* w-64 */
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-interactive);
    z-index: 10;
    padding: 0.25rem;
    max-height: 20rem; /* max-h-80 */
    overflow-y: auto;
}
.view-as-dropdown ul {
    list-style: none;
}
.view-as-dropdown li button {
    width: 100%;
    text-align: left;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 6px;
}
.view-as-dropdown li button:hover {
    background: var(--surface-color-hover);
}
.view-as-dropdown .separator {
    margin: 0.25rem 0;
    border-top: 1px solid var(--border-color);
}
.view-as-dropdown .class-header {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-color-secondary);
    text-transform: uppercase;
}
.view-as-dropdown .no-students {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: var(--text-color-secondary);
    font-style: italic;
}

/* --- File Browser --- */
.file-browser-main {
    padding: 1rem 1.5rem;
    flex-grow: 1;
    overflow-y: auto;
}

.file-browser-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.file-browser-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.file-browser-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Breadcrumbs */
.assignments-breadcrumbs {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-color-secondary);
    flex-wrap: wrap;
}
.assignments-breadcrumbs button {
    background: none; border: none; color: inherit; cursor: pointer; font-size: inherit;
}
.assignments-breadcrumbs button:hover { text-decoration: underline; }
.assignments-breadcrumbs .separator { margin: 0 0.5rem; }
.assignments-breadcrumbs .current { font-weight: 500; color: var(--text-color); }


/* Grid/List View Toggle */
.assignments-view-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-color-inset);
    padding: 4px;
    border-radius: 8px;
}
.assignments-view-toggle button {
    background: transparent; border: none; padding: 0.5rem; border-radius: 6px;
    color: var(--text-color-secondary); cursor: pointer; display: flex;
}
.assignments-view-toggle button.active {
    background: var(--primary-color);
    color: var(--white);
}

/* File Grid */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
}
.file-grid-item {
    position: relative; 
    aspect-ratio: 1 / 1; 
    background: var(--surface-color-inset);
    border-radius: 12px; 
    border: 1px solid var(--border-color);
    transition: background-color 0.2s, transform 0.2s;
    display: flex;
}
.file-grid-item:hover {
    background: var(--surface-color-hover); 
    transform: translateY(-4px);
}
/* The wrapper for content, whether it's a button or div */
.file-grid-item > button, .file-grid-item > div {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.75rem;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    border-radius: 12px; /* For focus ring */
}
.file-grid-item > button { cursor: pointer; }
.file-grid-item > div { cursor: default; }
.file-grid-item .item-name { 
    font-size: 0.8rem; 
    margin-top: 0.75rem; 
    color: var(--text-color); 
    word-break: break-word; 
    /* Truncation for long names */
    line-height: 1.3;
    max-height: 2.6em; /* 2 lines */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-grid-item .item-icon { width: 40px; height: 40px; }
.file-grid-item .item-icon svg { width: 100%; height: 100%; }
.file-grid-item .thumbnail { 
    width: 100%;
    height: 100%;
    max-height: 60%;
    object-fit: cover; 
    border-radius: 8px;
}
.file-grid-item .assignment-action { 
    position: absolute; top: 0.5rem; right: 0.5rem; 
}


/* List View */
.file-list { 
    display: flex; 
    flex-direction: column; 
    gap: 0.5rem; 
}
.file-list-item {
    display: flex;
    align-items: center;
    gap: 1rem; 
    padding: 0.75rem; 
    border-radius: 8px; 
    transition: background-color 0.2s;
}
.file-list-item:hover { 
    background: var(--surface-color-hover); 
}
.file-list-item .item-icon { 
    width: 24px; height: 24px; flex-shrink: 0; 
}
.file-list-item .item-icon svg { 
    width: 100%; height: 100%; 
}
.file-list-item .item-name-button {
    flex-grow: 1;
    background: none; 
    border: none; 
    color: inherit; 
    font: inherit; 
    cursor: pointer;
    text-align: left; 
    min-width: 0; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
}
.file-list-item .item-name-button:hover { text-decoration: underline; }
/* Target the div holding the action buttons */
.file-list-item > div:last-child {
    flex-shrink: 0;
}


/* --- Modals --- */
.modal-backdrop {
    position: fixed; inset: 0; background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
    z-index: 50;
}
.modal-content-react {
    background: var(--surface-color); border: 1px solid var(--border-color);
    border-radius: 12px; box-shadow: var(--shadow-interactive);
    width: 100%; max-width: 28rem; /* max-w-sm */ margin: 1rem;
}
.modal-content-react form .modal-body {
    padding: 1.5rem;
}
.modal-content-react form h2 {
    font-size: 1.125rem; /* text-lg */ font-weight: 600; margin-bottom: 1rem;
}
.modal-content-react form label {
    font-size: 0.875rem; /* text-sm */ font-weight: 500; color: var(--text-color-secondary);
}
.modal-content-react form input[type="text"] {
    width: 100%; background: var(--surface-color-inset); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 0.5rem 0.75rem; font-size: 0.875rem;
    margin-top: 0.25rem;
}
.modal-content-react form input[type="text"]:focus {
    outline: none; box-shadow: 0 0 0 2px var(--primary-color);
}
.modal-content-react .modal-footer {
    background: var(--surface-color-inset); padding: 0.75rem 1.5rem;
    display: flex; justify-content: flex-end; align-items: center; gap: 0.75rem;
    border-bottom-left-radius: 12px; border-bottom-right-radius: 12px;
}

/* Video Review Modal */
.video-review-modal-container {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px); z-index: 50; display: flex; flex-direction: column;
    padding: 1rem;
}
.video-review-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem; flex-shrink: 0;
}
.video-review-modal-header h2 {
    font-size: 1.25rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 1rem;
}
.video-review-modal-header button,
.image-review-modal-header button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--text-color-secondary);
    transition: background-color 0.2s, color 0.2s;
}

.video-review-modal-header button:hover,
.image-review-modal-header button:hover {
    background-color: var(--surface-color-hover);
    color: var(--text-color);
}

.video-review-modal-header button svg,
.image-review-modal-header button svg {
    width: 24px;
    height: 24px;
}
.video-review-modal-grid {
    flex-grow: 1; 
    display: flex; 
    gap: 1.5rem; 
    min-height: 0;
}
.video-player-container {
    background: #000; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    position: relative; 
    border-radius: 8px; 
    overflow: hidden;
    flex-grow: 1;
    min-width: 0;
}
.video-player-container video {
    width: 100%; 
    height: 100%; 
    object-fit: contain;
}
.video-play-pause-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}
.video-play-pause-btn svg {
    width: 32px;
    height: 32px;
}
.video-player-container:hover .video-play-pause-btn,
.video-play-pause-btn:not(.is-playing) {
    opacity: 1;
}

.video-controls {
    position: absolute; bottom: 0; left: 0; right: 0; padding: 1rem;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    display: flex;
    flex-direction: column;
}
.progress-bar-container {
    width: 100%; height: 8px; background: rgba(255,255,255,0.2);
    border-radius: 4px; cursor: pointer; position: relative;
}
.progress-bar { height: 100%; background: var(--primary-color); border-radius: 4px; }

.comment-marker-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 5;
}
.comment-marker {
    width: 10px; height: 10px; background: var(--pending-color);
    border-radius: 50%;
    border: 1px solid var(--surface-color-inset);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.2s;
}
.comment-marker-button:hover .comment-marker {
    transform: translate(-50%, -50%) scale(1.5);
}

.video-controls-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}
.video-time-display {
    display: flex; gap: 0.5rem; font-size: 0.8rem;
    color: var(--white);
}
.video-quality-selector {
    position: relative;
    font-size: 0.8rem;
    color: #ccc;
    cursor: help;
    background-color: rgba(0,0,0,0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}
.video-quality-selector .quality-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    margin-bottom: 5px;
    pointer-events: none;
}
.video-quality-selector:hover .quality-tooltip {
    display: block;
}


/* Image Review Modal */
.image-review-modal-container {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px); z-index: 50; display: flex; flex-direction: column;
    padding: 1rem 2rem 2rem;
}
.image-review-modal-container main {
    flex-direction: column;
}
.image-review-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem; flex-shrink: 0;
}
.image-review-modal-header h2 {
    color: var(--text-color);
    font-size: 1.25rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 1rem;
}
.image-review-modal-body {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    min-height: 0;
    overflow: hidden; /* Contain pannable image */
}
.image-review-modal-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    will-change: transform;
}

.image-zoom-controls {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 0 0;
    margin-top: auto;
}
.image-zoom-controls .btn-icon {
    background: var(--surface-color);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
}
.image-zoom-controls .btn-icon:hover {
    background: var(--surface-color-hover);
}
.image-zoom-controls .btn-icon svg {
    width: 20px;
    height: 20px;
}
.zoom-display {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    background: var(--surface-color-inset);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    min-width: 70px;
    text-align: center;
}


/* Comments Pane */
.comments-pane {
    background: var(--surface-color); 
    display: flex; 
    flex-direction: column;
    overflow: hidden; 
    border-radius: 12px; 
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    width: 320px;
}
.comments-pane h3 {
    font-size: 1.125rem; font-weight: 600; padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.comments-list {
    flex-grow: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem;
}
.comment-item-header {
    display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem;
}
.comment-item-author { font-weight: 600; color: var(--text-color); }
.comment-item-timestamp {
    background: none; border: none; color: var(--accent-color-text);
    cursor: pointer; font-family: monospace;
}
.comment-item-timestamp:hover { text-decoration: underline; }
.comment-item-text {
    font-size: 0.9rem; color: var(--text-color-secondary); white-space: pre-wrap;
    word-break: break-word; margin-top: 0.25rem;
}
.comment-form { padding: 1rem; border-top: 1px solid var(--border-color); }
.comment-form textarea {
    width: 100%; background: var(--surface-color-inset); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 0.5rem 0.75rem; font-size: 0.9rem; margin-bottom: 0.5rem;
}
.comment-form textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--primary-color); }

/* --- General Utility Classes from React code --- */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-primary:hover {
    background-color: #0044a8;
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--surface-color-hover);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-secondary:hover {
    background-color: #475569; /* slate-600 */
}