* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: white;
}

.logo-icon {
    font-size: 2rem;
    line-height: 1;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1.5rem;
    border-left: 1px solid rgba(255,255,255,0.2);
}

.nav-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: #ecf0f1;
    font-size: 0.875rem;
}

.user-name {
    font-weight: 600;
    color: white;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.8);
    text-transform: uppercase;
    margin-top: 2px;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.15);
    transform: translateY(-1px);
}

.nav-link-active {
    font-weight: 600;
}

.nav-link-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 3px;
    background-color: white;
    border-radius: 3px 3px 0 0;
}

.nav-icon {
    padding: 0.5rem;
    font-size: 1.2rem;
    min-width: 40px;
    text-align: center;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
}

.logout-icon {
    font-size: 1.1rem;
    font-weight: bold;
}

.logout-text {
    font-size: 0.95rem;
    font-weight: 500;
}

.logout-btn:hover {
    background-color: rgba(231, 76, 60, 0.3);
}

.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 100px);
    padding: 2rem 1rem;
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    margin-bottom: 1rem;
    text-align: center;
    color: #2c3e50;
    font-size: 2rem;
}

.login-header {
    text-align: center;
}

.login-header .logo-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-header p {
    margin-bottom: 2rem;
    color: #666;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    color: #2c3e50;
}

.search-section {
    margin-bottom: 1.5rem;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-btn-text {
    display: inline-block;
}

.search-btn-icon {
    display: none;
}

.search-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
}

.divider {
    height: 1px;
    background-color: #ddd;
    margin: 1.5rem 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-edit {
    background-color: #f39c12;
    color: white;
}

.btn-edit:hover {
    background-color: #e67e22;
}

.btn-delete {
    background-color: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background-color: #c0392b;
}

.flash-messages {
    margin-bottom: 1rem;
}

.flash-message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.flash-error {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.flash-success {
    background-color: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.files-table,
.users-table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.files-table thead,
.users-table thead {
    background-color: #34495e;
    color: white;
}

.files-table th,
.files-table td,
.users-table th,
.users-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.files-table tbody tr:hover,
.users-table tbody tr:hover {
    background-color: #f9f9f9;
}

.files-table tbody tr.file-by-other td:first-child {
    font-weight: 600;
    color: #5a67d8;
}

.download-icon {
    display: inline-block;
    margin-right: 8px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    filter: brightness(0) saturate(100%) invert(52%) sepia(95%) saturate(1352%) hue-rotate(182deg) brightness(95%) contrast(89%);
}

.file-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.file-link:hover {
    text-decoration: underline;
}

.assigned-users {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.user-badge {
    background-color: #ecf0f1;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.user-badge:hover {
    background-color: #bdc3c7;
}

.readonly-badge {
    color: #7f8c8d;
    font-size: 0.875rem;
}

.downloaded-by-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.download-badge {
    display: inline-block;
    background-color: #d4edda;
    color: #155724;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.text-muted {
    color: #999;
}

.pagination {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 1rem;
}

.close:hover {
    color: #000;
}

.modal-content.modal-confirm {
    max-width: 420px;
}

.confirm-message {
    margin: 1rem 0 1.5rem;
    color: #333;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.edit-file-readonly {
    margin: 0;
    padding: 0.5rem 0;
    color: #555;
    font-size: 0.95rem;
}

.file-upload-area {
    border: 2px dashed #3498db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s;
    background-color: #f8f9fa;
}

.file-upload-area:hover {
    background-color: #e9ecef;
}

.file-upload-area.dragover {
    background-color: #d4edda;
    border-color: #28a745;
}

.file-upload-area p {
    margin: 0;
    color: #666;
}

.selected-files-list {
    margin: 0.5rem 0 0 0;
    padding-left: 1.25rem;
    text-align: left;
    font-size: 0.85rem;
    color: #555;
    max-height: 120px;
    overflow-y: auto;
}

.selected-files-list li {
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.upload-progress {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.upload-progress.active {
    display: block;
}

.upload-progress-status {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.upload-progress-bar-wrap {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.user-checkboxes {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    background-color: #f9f9f9;
}

.checkbox-label {
    display: block;
    padding: 0.5rem;
    cursor: pointer;
}

.checkbox-label:hover {
    background-color: #e9ecef;
}

.checkbox-label.select-all-row {
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 0.25rem;
    padding-bottom: 0.5rem;
}

.account-info {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.info-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.info-section:last-child {
    border-bottom: none;
}

.info-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.info-section p {
    margin-bottom: 0.5rem;
}

.toast-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 300px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    border-left: 4px solid;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left-color: #27ae60;
}

.toast-error {
    border-left-color: #e74c3c;
}

.toast-warning {
    border-left-color: #f39c12;
}

.toast-info {
    border-left-color: #3498db;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.toast-icon {
    font-size: 1.25rem;
    font-weight: bold;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    background-color: #27ae60;
    color: white;
}

.toast-error .toast-icon {
    background-color: #e74c3c;
    color: white;
}

.toast-warning .toast-icon {
    background-color: #f39c12;
    color: white;
}

.toast-info .toast-icon {
    background-color: #3498db;
    color: white;
}

.toast-message {
    color: #333;
    font-size: 0.95rem;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    margin-left: 1rem;
    line-height: 1;
    transition: color 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #333;
}

.file-card,
.user-card {
    display: none;
}

@media (max-width: 768px) {
    body {
        font-size: 0.8em;
    }

    .navbar {
        position: sticky;
        top: 0;
    }

    .nav-container {
        height: auto;
        padding: 0.75rem 1rem;
        flex-direction: row;
        justify-content: space-between;
    }

    .nav-brand {
        display: flex;
    }

    .nav-logo {
        display: none;
    }

    .nav-menu {
        width: 100%;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .nav-user-section {
        border-left: none;
        padding-left: 0;
        gap: 0.5rem;
    }

    .nav-user {
        display: none;
    }

    .nav-link {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }

    .nav-link-active::after {
        bottom: 0;
        top: auto;
        width: 80%;
        height: 3px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 3px 3px 0 0;
    }

    .container {
        margin-bottom: 0;
        padding: 0 1rem;
    }

    .modal.show {
        padding: 1rem;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 1.5rem;
        max-height: calc(100vh - 2rem);
    }

    .files-table,
    .users-table {
        display: none;
    }

    .files-list,
    .users-list {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .file-card,
    .user-card {
        display: block;
        background: white;
        border-radius: 8px;
        padding: 0.75rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .file-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #eee;
    }

    .file-card-title {
        font-weight: 600;
        font-size: 1rem;
        color: #333;
        flex: 1;
    }

    .file-card-title.file-by-other {
        color: #5a67d8;
    }

    .file-card-meta {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.875rem;
        color: #666;
    }

    .file-card-meta-item {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .file-card-meta-label {
        font-weight: 500;
        color: #555;
        min-width: 100px;
    }

    .file-card-file-name {
        width: 100%;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid #eee;
    }

    .file-card-file-name .file-link {
        display: block;
        word-break: break-all;
        width: 100%;
    }

    .file-card-actions {
        display: flex;
        gap: 0.5rem;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid #eee;
    }

    .user-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #eee;
    }

    .user-card-name {
        font-weight: 600;
        font-size: 1rem;
        color: #333;
    }

    .user-card-meta {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.875rem;
        color: #666;
    }

    .user-card-meta-item {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .user-card-meta-label {
        font-weight: 500;
        color: #555;
        min-width: 100px;
    }

    .user-card-actions {
        display: flex;
        gap: 0.5rem;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid #eee;
    }

    .page-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
    }

    .page-header h2 {
        margin: 0;
        flex: 1;
        font-size: 2.5em;
    }

    .search-form {
        flex-direction: row;
        gap: 0.5rem;
    }

    .search-input {
        flex: 1;
        padding: 0.5rem;
    }

    .form-group {
        margin-bottom: 0.75rem;
    }

    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"],
    .form-group textarea {
        padding: 0.5rem;
    }

    .btn {
        padding: 0.5rem 1rem;
    }

    .btn-sm {
        padding: 0.4rem 0.75rem;
    }

    .search-btn-text {
        display: none;
    }

    .search-btn-icon {
        display: inline-block;
    }

    .search-btn {
        padding: 0.5rem;
        min-width: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .search-btn-icon {
        font-size: 1rem;
    }

    .pagination {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    .login-container {
        padding: 1rem;
        min-height: calc(100vh - 60px);
    }

    .login-box {
        padding: 1.5rem;
    }

    .login-box h1 {
        font-size: 1.75em;
        margin-bottom: 0.75rem;
    }

    .login-header .logo-icon {
        font-size: 2.5rem !important;
        margin-bottom: 0.75rem !important;
    }

    .login-header p {
        margin-bottom: 1.5rem !important;
        font-size: 0.9em;
    }
}
