/* css/style.css */
html, body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    padding-bottom: 1rem; /* Space for footer if not sticky */
    flex: 1;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.navbar-brand {
    font-weight: bold;
}

.file-card {
    transition: transform .2s ease-in-out, box-shadow .2s ease-in-out;
    cursor: pointer;
    height: 100%; 
    display: flex; /* Added for consistent card structure */
    flex-direction: column; /* Added for consistent card structure */
}

.file-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
[data-bs-theme="dark"] .file-card:hover {
    box-shadow: 0 4px 20px rgba(255,255,255,0.08);
}


.file-card .card-img-top {
    width: 100%;
    height: 150px; 
    object-fit: contain; 
    background-color: var(--bs-tertiary-bg); /* Use Bootstrap variable */
    padding: 10px;
    border-bottom: 1px solid var(--bs-border-color);
}

.file-card .card-body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1; /* Allow card body to grow */
}

.file-card .file-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.75em;
}

.file-description {
    font-size: 0.9em;
    color: var(--bs-secondary-color);
    margin-bottom: 1rem;
    /* flex-grow: 1; Removed to let card-body handle overall flex grow */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Limit to 3 lines */
    -webkit-box-orient: vertical;
    min-height: calc(0.9em * 1.5 * 3); /* Approx height for 3 lines, adjust line-height (1.5) as needed */
}


.file-meta span {
    margin-right: 10px;
    font-size: 0.8em;
}

.file-meta .bi {
    margin-right: 3px;
}

@media (max-width: 576px) {
    #fileList {
        row-cols: 1 !important; 
    }
    .file-card .card-img-top {
        height: 120px;
    }
    .file-description {
        -webkit-line-clamp: 2; /* Limit to 2 lines on smaller screens */
        min-height: calc(0.9em * 1.5 * 2);
    }
}

/* Theme Switcher Styling */
.theme-switch-wrapper .form-check-label.visually-hidden { /* Ensure this is actually hidden */
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    white-space: nowrap;
}
.theme-switch-wrapper .form-check-input {
    cursor: pointer;
    height: 1.3em;
    width: 2.5em;
    margin-top: 0.1em; /* Align better with text */
    background-color:darkgray;
}
.theme-toggle-icon-label {
    color: var(--bs-navbar-color);
    cursor: pointer;
    margin-left: 0.5rem;
    font-size: 1.1rem; /* Adjust icon size */
}

[data-bs-theme="light"] .theme-toggle-icon-label .icon-sun { display: none; }
[data-bs-theme="dark"] .theme-toggle-icon-label .icon-moon { display: none; }

/* Navbar adjustments */
.navbar-nav .nav-item .nav-link {
    color: var(--bs-navbar-color);
}
.nav-item .dropdown-menu { /* Ensure dropdown menu also themes */
    --bs-dropdown-link-hover-bg: var(--bs-secondary-bg);
}
.navbar-toggler {
    border-color: rgba(255,255,255,0.2); /* Lighter border for toggler on dark bg */
}
.navbar-toggler-icon {
     background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Ensure badge contrast */
.file-type-badge.bg-info-subtle {
    /* Bootstrap handles this well with data-bs-theme */
}

/* Footer to stick to bottom if content is short */
body > footer {
    margin-top: auto; /* This pushes the footer to the bottom in a flex container */
}