/* css/finder.css */

/* Styles for Finder windows will be added here. */

/* Example structure for a Finder window (to be refined) */
/*.finder-window {
    position: absolute;
    width: 700px;
    height: 500px;
    background-color: rgba(240, 240, 240, 0.95); 
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    color: #333; 
    z-index: 100; 
    pointer-events: auto; 
}

.finder-window-header {
    height: 30px;
    background-color: rgba(220, 220, 220, 0.95); 
    display: flex;
    align-items: center;
    padding: 0 10px;
    cursor: grab; 
}

.traffic-lights {
    display: flex;
    gap: 8px;
}

.traffic-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.close {
    background-color: #ff5f57; 
}

.minimize {
    background-color: #ffbd2e; 
}

.fullscreen {
    background-color: #28c940; 
}

.window-title {
    flex-grow: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    padding-right: 40px; 
}

.finder-window-body {
    flex-grow: 1;
    display: flex;
}

.finder-sidebar {
    width: 180px;
    background-color: rgba(230, 230, 230, 0.95); 
    padding: 10px;
    border-right: 1px solid rgba(0,0,0,0.1);
}

.finder-content {
    flex-grow: 1;
    padding: 10px;
    overflow-y: auto;
}
*/ 

/* Styles specific to Finder-like windows */

/* Override for the main .finder-window if it contains a .finder-body-container */
.finder-window:has(.finder-body-container) {
    /* Base background (glass) is inherited from window-frame.css */
    /* Specific overrides for finder window size or base appearance could go here if needed */
    /* Enable container queries for responsive sidebar */
    container-type: inline-size;
}

/* Removed vertical separator line that was dividing title bar sections */
/* .finder-window:has(.finder-body-container)::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 200px;
    width: 1px;
    background-color: rgba(0, 0, 0, 0.1);
    z-index: 15;
} */

/* Title bar styling specific to Finder-like windows */
.finder-window:has(.finder-body-container) .title-bar {
    background-color: rgb(255, 255, 255); /* Solid white background for entire title bar */
    position: relative; /* Stacking context for pseudo-elements */
    z-index: 10; /* Ensure title bar content is above sidebar extended background */
}

/* Sidebar tint in title bar area - REMOVED, sidebar will extend */
/* .finder-window:has(.finder-body-container) .title-bar::before { ... } */

/* Removed segmented title bar styling - no longer needed with uniform white background */
/* .finder-window:has(.finder-body-container) .title-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: 200px;
    right: 0;
    height: 100%;
    background-color: rgb(249, 249, 249);
    z-index: -1;
} */

.finder-body-container {
    display: flex;
    height: calc(100% - 32px); /* Corrected to match actual title bar height of 32px */
    position: relative;
    z-index: 1; /* Ensure body is above main window background but below title bar elements */
}

/* Add horizontal separator line across full width at top of body container */
.finder-body-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-color: rgba(0, 0, 0, 0.1);
    z-index: 3;
}

/* Add vertical separator line between sidebar and content pane */
.finder-body-container::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 200px; /* Width of sidebar */
    width: 1px;
    background-color: rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.finder-sidebar {
    width: 200px;
    min-width: 200px; /* Add min-width for transition */
    height: 100%;
    background-color: transparent; /* Totally transparent */
    backdrop-filter: none; /* Explicitly remove any backdrop filter */
    -webkit-backdrop-filter: none; /* Explicitly remove any backdrop filter for Safari */
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden; /* Hide content during transition */
    position: relative; /* Needed if z-index is used, but primarily for stacking context */
    /* z-index: 5; /* Ensure sidebar background is above main window background */
    flex-shrink: 0; /* Sidebar should not shrink */
    
    /* Smooth transition for sidebar hide/show */
    transition: min-width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), 
                width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
                padding 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
                opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #666666; /* Grayish text for section titles like "DESKTOP" */
    margin-top: 15px;
    margin-bottom: 5px;
    padding-left: 5px;
    text-transform: uppercase;
}

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

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 5px;
    cursor: default; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #000000; /* Black text */
}

.sidebar-icon {
    width: 16px;
    height: 16px;
    margin-right: 5px;
    flex-shrink: 0;
    object-fit: contain;
    transition: none; /* Explicitly disable transitions */
}

.sidebar-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.sidebar-item.selected {
    background-color: rgba(0, 0, 0, 0.1);
}
.sidebar-item.selected span {
    font-weight: 600;
}

.finder-content-pane {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: scroll; 
    background-color: #fff; 
    scroll-behavior: smooth; /* Enables smooth scrolling for programmatic scroll actions */
    
    /* Enhanced touch scrolling */
    -webkit-overflow-scrolling: touch; /* Enable momentum scrolling on iOS */
    touch-action: pan-y; /* Allow vertical scrolling only */
    overscroll-behavior: contain; /* Prevent scroll chaining */
}

.content-pane-header {
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    /* border-top: 1px solid rgba(0, 0, 0, 0.1); */ /* Removed - replaced by full-width line */
    background-color: #fff;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    user-select: none;
}

.header-column.name-column {
    text-align: left;
    flex-grow: 1;
    min-width: 0; /* Allow header name column to shrink */
    padding-right: 10px;
}

.header-column.date-column {
    text-align: left !important; /* Ensure left alignment for header */
    /* width: 120px; */ /* Removed: Width will be determined by content */
    flex-shrink: 0;
    padding-left: 10px; /* Add some padding to separate from name column */
}

.content-pane-list {
    flex-grow: 1;
    overflow-y: auto;
    background: repeating-linear-gradient(
        to bottom,
        #fff 0px,
        #fff 32px,
        rgb(244, 245, 245) 32px,
        rgb(244, 245, 245) 64px
    );
    padding: 0;
    margin: 0;
    /* Hide scrollbar while maintaining functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    
    /* Touch scrolling optimizations from old website */
    -webkit-overflow-scrolling: touch; /* Enable momentum scrolling on iOS */
    touch-action: pan-y; /* Allow vertical scrolling only */
    overscroll-behavior: contain; /* Prevent scroll chaining */
}

/* Hide scrollbar for WebKit browsers */
.content-pane-list::-webkit-scrollbar {
    display: none;
}

.list-item {
    display: flex;
    justify-content: space-between; /* Ensure content spans full width */
    align-items: center; /* Vertically center content */
    padding: 6px 15px;
    font-size: 13px;
    border-bottom: 1px solid rgb(240, 240, 240);
    cursor: default;
    overflow: hidden;
    width: 100%; /* Ensure full width */
    box-sizing: border-box; /* Include padding in width calculation */
    height: 32px; /* Fixed height for consistent stripes */
    background-color: transparent; /* Remove individual item backgrounds */
}

.list-item:hover {
    background-color: rgba(0, 0, 0, 0.04); 
}

.list-item.selected {
    background-color: rgb(0, 100, 225); /* User requested selection color */
}

/* Default text colors for file name and date */
.list-item .file-name {
    color: rgb(37, 37, 37);
}

.list-item .file-date {
    color: rgb(123, 124, 124);
}

/* Text colors when list item is selected */
.list-item.selected .file-name {
    color: white;
}

.list-item.selected .file-date {
    color: rgb(187, 209, 247);
    /* text-align: left; */ /* Alignment handled by parent */
}

.file-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    object-fit: contain;
    flex-shrink: 0;
    order: -1; /* Ensure icon appears before text in flex layout */
}

.file-name {
    flex-grow: 1; /* Ensure name column takes available space */
    flex-shrink: 1; /* Allow it to shrink */
    padding-right: 10px; /* Keep padding for spacing */
    min-width: 0; /* Allow flex item to shrink fully for truncation */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: ltr; /* Explicitly set LTR for standard end ellipsis */
    text-align: left; /* Keep text aligned left visually */
    display: flex; /* Make it a flex container for icon and text */
    align-items: center; /* Center icon and text vertically */
}

.file-date {
    text-align: right; /* Right-align the date */
    flex-shrink: 0; /* Prevent shrinking */
    white-space: nowrap; /* Prevent date text from wrapping */
    padding-left: 10px; /* Add some padding to separate from name column */
    min-width: 120px; /* Fixed minimum width for date column */
}

/* --- Finder Specific Focus Styles --- */

.finder-window:not(.focused) .sidebar-section-title {
    color: rgb(112, 112, 112);
}

/* Target the span inside sidebar items to change text color without affecting background/selection state */
.finder-window:not(.focused) .sidebar-item span {
    color: rgb(112, 112, 112);
}

/* Switch to grey icons when window is not focused */
.finder-window:not(.focused) .sidebar-item[data-folder-id="projects"] .sidebar-icon {
    content: url(../assets/folder/projects-grey.png);
    transition: content 0s;
}

.finder-window:not(.focused) .sidebar-item[data-folder-id="side-projects"] .sidebar-icon {
    content: url(../assets/folder/sideprojects-grey.png);
    transition: content 0s;
}

.finder-window:not(.focused) .sidebar-item[data-folder-id="work"] .sidebar-icon {
    content: url(../assets/folder/work-grey.png);
    transition: content 0s;
}

.finder-window:not(.focused) .sidebar-item[data-folder-id="education"] .sidebar-icon {
    content: url(../assets/folder/education-grey.png);
    transition: content 0s;
}

.finder-window:not(.focused) .sidebar-item[data-folder-id="trash"] .sidebar-icon {
    content: url(../assets/folder/trash-grey.png);
    transition: content 0s;
}

/* Ensure selected item text color is also grayed out when window is not focused */
.finder-window:not(.focused) .sidebar-item.selected span {
    color: rgb(112, 112, 112);
    /* font-weight: normal; /* Optional: remove bolding when not focused? */
}

/* Restore default colors and icons when focused */
.finder-window.focused .sidebar-section-title {
    color: #666666; /* Default from original styles */
}

.finder-window.focused .sidebar-item span {
    color: #000000; /* Default from original styles */
}

/* Restore colored icons when window is focused */
.finder-window.focused .sidebar-item[data-folder-id="projects"] .sidebar-icon {
    content: url(../assets/folder/projects.png);
    transition: content 0s;
}

.finder-window.focused .sidebar-item[data-folder-id="side-projects"] .sidebar-icon {
    content: url(../assets/folder/sideprojects.png);
    transition: content 0s;
}

.finder-window.focused .sidebar-item[data-folder-id="work"] .sidebar-icon {
    content: url(../assets/folder/work.png);
    transition: content 0s;
}

.finder-window.focused .sidebar-item[data-folder-id="education"] .sidebar-icon {
    content: url(../assets/folder/education.png);
    transition: content 0s;
}

.finder-window.focused .sidebar-item[data-folder-id="trash"] .sidebar-icon {
    content: url(../assets/folder/trash.png);
    transition: content 0s;
}

.finder-window.focused .sidebar-item.selected span {
    color: #000000; /* Default black for selected item */
    font-weight: 600; /* Ensure bolding is restored */
} 

/* --- Trash Window Specific Styles --- */
.finder-window.trash-window .content-pane-header {
    display: none; /* Hide the header row with Name and Date */
}

.finder-window.trash-window .content-pane-list {
    /* Override the alternating background for the trash window */
    background-image: none;
    background-color: white;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 20px;
    position: relative;
    /* Add top border to replace the hidden header separator line */
    /* border-top: 1px solid rgba(0, 0, 0, 0.1); */ /* Removed - replaced by full-width line */
}

/* Icon view styles for trash items */
.finder-window.trash-window .list-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background-color: transparent !important;
    width: 100%;
    height: 120px;
    margin: 0;
    padding: 5px;
    border-radius: 5px;
    cursor: default;
    position: relative;
    overflow: visible;
    border: 1px solid transparent;
    box-sizing: border-box;
}

.finder-window.trash-window .list-item.dragging {
    opacity: 0.7;
    cursor: grabbing;
    background-color: rgba(0, 0, 0, 0.05) !important;
    border: 1px dashed #aaa;
    z-index: 10;
}

.finder-window.trash-window .list-item:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

.finder-window.trash-window .list-item.selected {
    background-color: rgba(0, 100, 225, 0.2) !important;
}

.finder-window.trash-window .file-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.finder-window.trash-window .file-name {
    text-align: center;
    width: 100%;
    font-size: 12px;
    line-height: 1.3;
    margin: 0;
    padding: 0 5px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    display: block;
}

.finder-window.trash-window .file-date {
    display: none;
}

/* Trash window title styling */
.finder-window.trash-window .trash-title-prefix {
    font-style: italic;
    font-size: 0.8em;
    color: #999;
    font-weight: normal;
    margin-left: 10px;
}

/* --- macOS Warning Modal Styles --- */
.macos-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999; /* Extremely high to ensure it's above everything */
}

.macos-modal {
    background-color: rgba(250, 250, 250, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    width: 320px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.macos-modal-icon {
    width: 70px;
    height: 70px;
    object-fit: contain;
    margin-bottom: 15px;
}

.macos-modal-title {
    font-size: 13px;
    font-weight: bold;
    color: #000;
    margin: 0;
    line-height: 1.4;
    text-align: center;
}

.macos-modal-subtitle {
    font-size: 13px;
    color: #666;
    margin: 6px 0 25px 0;
    text-align: center;
    width: 100%;
    line-height: 1.4;
}

.macos-modal-button {
    background-color: #4388F7;
    color: white;
    border: none;
    outline: none;
    border-radius: 5px;
    padding: 0 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    min-width: 120px;
    height: 30px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.macos-modal-button:focus {
    outline: none;
    box-shadow: none;
}

.macos-modal-button:hover {
    background-color: #3b7ae0;
}

.macos-modal-button:active {
    background-color: #3470d2;
}

/* --- End Trash Window Specific Styles --- */

/* --- Responsive Sidebar Hiding --- */
/* Smoothly hide sidebar when window width is less than 620px */
@container (max-width: 619px) {
    .finder-sidebar {
        min-width: 0;
        width: 0;
        padding: 0;
        opacity: 0;
    }
    
    .finder-content-pane {
        width: 100%;
        flex-grow: 1;
    }
    
    /* Hide vertical separator line when sidebar is collapsed */
    .finder-body-container::after {
        opacity: 0;
    }
}

/* Additional fallback using direct window width detection */
.finder-window[style*="width: 5"] .finder-sidebar,
.finder-window[style*="width: 4"] .finder-sidebar,
.finder-window[style*="width: 3"] .finder-sidebar {
    min-width: 0;
    width: 0;
    padding: 0;
    opacity: 0;
}

/* Hide separator line for fallback cases */
.finder-window[style*="width: 5"] .finder-body-container::after,
.finder-window[style*="width: 4"] .finder-body-container::after,
.finder-window[style*="width: 3"] .finder-body-container::after {
    opacity: 0;
} 