/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #1f2937;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Remove tap highlight on mobile */
a, button, input, textarea, select {
    -webkit-tap-highlight-color: transparent;
}

/* Improve touch scrolling on iOS */
.modal-content,
.files-list,
.users-list {
    -webkit-overflow-scrolling: touch;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.nav-brand {
    font-size: 20px;
    font-weight: 700;
    color: #2563eb;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-user {
    color: #6b7280;
    font-size: 14px;
}

.nav-link {
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #f3f4f6;
    color: #2563eb;
}

.nav-link.active {
    background: #2563eb;
    color: white;
}

/* Auth Box */
.auth-box {
    background: white;
    border-radius: 16px;
    padding: 48px;
    max-width: 480px;
    margin: 60px auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-box h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
    text-align: center;
}

.subtitle {
    color: #6b7280;
    font-size: 16px;
    text-align: center;
    margin-bottom: 32px;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input[type="email"],
.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* Divider */
.divider {
    position: relative;
    text-align: center;
    margin: 32px 0;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: #e5e7eb;
}

.divider span {
    position: relative;
    background: white;
    padding: 0 16px;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 600;
}

/* Upload Container */
.upload-container {
    background: white;
    border-radius: 16px;
    padding: 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.upload-container h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #cbd5e1;
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    transition: all 0.3s;
    background: #f9fafb;
    margin-top: 32px;
}

.upload-area.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
    transform: scale(1.02);
}

.upload-icon {
    width: 80px;
    height: 80px;
    color: #2563eb;
    margin: 0 auto 24px;
}

.upload-text {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

.upload-subtext {
    color: #9ca3af;
    margin-bottom: 24px;
}

.upload-info {
    font-size: 14px;
    color: #6b7280;
    margin-top: 24px;
    line-height: 1.8;
}

/* File Preview */
.file-preview {
    background: #f9fafb;
    border-radius: 12px;
    padding: 32px;
    margin-top: 32px;
}

.file-preview h3 {
    margin-bottom: 16px;
    color: #1f2937;
}

.file-details {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.file-details p {
    margin: 8px 0;
    color: #4b5563;
}

/* File List for Multiple Upload */
.file-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 24px;
}

.file-queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.file-queue-item:hover {
    background: #f3f4f6;
}

.file-queue-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-queue-size {
    font-size: 13px;
    color: #6b7280;
}

/* Upload Queue */
.queue-list {
    margin-top: 24px;
}

.queue-item {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.queue-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.queue-status {
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
}

.queue-status.uploading {
    background: #dbeafe;
    color: #1e40af;
}

.queue-status.success {
    background: #d1fae5;
    color: #065f46;
}

.queue-status.error {
    background: #fee2e2;
    color: #991b1b;
}

/* Progress */
.progress-container {
    margin-top: 32px;
}

.progress-bar {
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb 0%, #1e40af 100%);
    border-radius: 12px;
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-weight: 600;
    color: #2563eb;
}

/* Files Container */
.files-container {
    background: white;
    border-radius: 16px;
    padding: 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.files-container h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

/* Files List */
.files-list {
    margin-top: 32px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.file-item:hover {
    background: #f3f4f6;
    transform: translateX(4px);
}

.file-icon {
    flex-shrink: 0;
}

.file-icon svg {
    width: 40px;
    height: 40px;
    color: #2563eb;
}

.file-info {
    flex-grow: 1;
}

.file-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.file-meta {
    font-size: 14px;
    color: #6b7280;
}

.file-actions {
    display: flex;
    gap: 8px;
}

/* Folders */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.folder-item {
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.folder-item:hover {
    background: #fde68a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.2);
}

.folder-link {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #92400e;
    min-width: 0;
}

.folder-icon {
    width: 32px;
    height: 32px;
    color: #f59e0b;
    flex-shrink: 0;
}

.folder-name {
    font-weight: 600;
    font-size: 15px;
    word-break: break-word;
}

.folder-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    color: #92400e;
}

.btn-icon:hover {
    background: rgba(146, 64, 14, 0.1);
}

.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-icon-danger:hover svg {
    color: #ef4444;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 40px;
}

.empty-icon {
    width: 120px;
    height: 120px;
    color: #cbd5e1;
    margin: 0 auto 24px;
}

.empty-state h3 {
    font-size: 24px;
    color: #1f2937;
    margin-bottom: 8px;
}

.empty-state p {
    color: #6b7280;
    margin-bottom: 24px;
}

/* Admin Container */
.admin-container {
    background: white;
    border-radius: 16px;
    padding: 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.admin-container h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.admin-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 2px solid #f3f4f6;
}

.admin-section:first-of-type {
    border-top: none;
    margin-top: 32px;
}

.admin-section h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    color: #1f2937;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding-top: 28px;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Users List */
.users-list {
    margin-top: 24px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 12px;
}

.user-info {
    flex-grow: 1;
}

.user-email {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #6b7280;
}

.user-actions {
    display: flex;
    gap: 8px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-admin {
    background: #dbeafe;
    color: #1e40af;
}

.text-muted {
    color: #9ca3af;
}

/* Storage Info */
.storage-info {
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.storage-text {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 12px;
}

.storage-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.storage-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

/* File Controls */
.file-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
}

.search-input:focus {
    outline: none;
    border-color: #2563eb;
}

/* File Checkbox */
.file-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-right: 12px;
    flex-shrink: 0;
}

/* Activity Log */
.activity-log {
    max-height: 600px;
    overflow-y: auto;
}

.activity-item {
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.activity-item strong {
    color: #1f2937;
}

.activity-item .activity-time {
    color: #9ca3af;
    font-size: 12px;
    display: block;
    margin-top: 4px;
}

.activity-item .activity-action {
    color: #2563eb;
    font-weight: 600;
}

/* Custom Confirmation Modal */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.confirm-modal.show {
    opacity: 1;
}

.confirm-modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.confirm-modal.show .confirm-modal-content {
    transform: scale(1);
}

.confirm-modal-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
}

.confirm-modal-message {
    font-size: 18px;
    color: #1f2937;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.6;
}

.confirm-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-modal-buttons .btn {
    min-width: 100px;
}

/* Responsive */
@media (max-width: 768px) {
    /* Container */
    .container {
        padding: 20px 16px;
    }
    
    /* Navigation - Stack on mobile */
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 12px 16px;
        gap: 12px;
    }
    
    .nav-brand {
        font-size: 18px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        width: 100%;
    }
    
    .nav-link {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .nav-user {
        font-size: 13px;
        width: 100%;
        text-align: center;
    }
    
    /* Auth Box */
    .auth-box {
        padding: 32px 20px;
        margin: 20px 16px;
    }
    
    .auth-box h1 {
        font-size: 24px;
    }
    
    /* Upload Container */
    .upload-container {
        padding: 24px 16px;
    }
    
    .upload-container h1 {
        font-size: 24px;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .upload-icon {
        width: 60px;
        height: 60px;
    }
    
    .upload-text {
        font-size: 18px;
    }
    
    .upload-subtext {
        font-size: 14px;
    }
    
    /* Files Container */
    .files-container {
        padding: 24px 16px;
    }
    
    .files-container h1 {
        font-size: 24px;
    }
    
    /* File List - Card style on mobile */
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
        gap: 12px;
    }
    
    .file-icon svg {
        width: 32px;
        height: 32px;
    }
    
    .file-info {
        width: 100%;
    }
    
    .file-name {
        font-size: 15px;
        word-break: break-word;
    }
    
    .file-meta {
        font-size: 13px;
    }
    
    .file-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    /* Buttons - Larger tap targets on mobile */
    .btn {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 8px 14px;
        font-size: 13px;
    }
    
    /* Form Elements */
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-control,
    .form-select,
    textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    textarea {
        min-height: 100px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* Admin Container */
    .admin-container {
        padding: 24px 16px;
    }
    
    .admin-container h1 {
        font-size: 24px;
    }
    
    .admin-section h2 {
        font-size: 20px;
    }
    
    /* User List */
    .user-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .user-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* Modals */
    .modal-content {
        width: 95%;
        max-width: 100%;
        margin: 20px;
        padding: 24px 16px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Empty State */
    .empty-state {
        padding: 40px 20px;
    }
    
    .empty-icon {
        width: 80px;
        height: 80px;
    }
    
    .empty-state h3 {
        font-size: 20px;
    }
    
    /* Toast Notifications */
    .toast-notification {
        right: 10px;
        left: 10px;
        top: 70px;
        max-width: calc(100% - 20px);
    }
    
    /* Tag Filter Bar */
    .tag-filter-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .tag-filters {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .tag-filter-btn {
        font-size: 12px;
        padding: 4px 10px;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* Upload Progress */
    .progress-bar {
        height: 6px;
    }
    
    /* Share Page */
    .share-container {
        padding: 24px 16px;
    }
    
    .share-container h1 {
        font-size: 24px;
    }
    
    /* Activity Log */
    .activity-item {
        font-size: 13px;
        padding: 12px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .nav-menu {
        flex-direction: column;
        width: 100%;
    }
    
    .nav-link {
        width: 100%;
        text-align: center;
    }
    
    .file-actions {
        flex-direction: column;
    }
    
    .file-actions .btn-sm {
        width: 100%;
    }
    
    .user-actions {
        flex-direction: column;
    }
    
    .user-actions .btn-sm {
        width: 100%;
    }
    
    /* Confirm modal */
    .confirm-modal-content {
        padding: 24px 20px;
    }
    
    .confirm-modal-buttons {
        flex-direction: column-reverse;
        width: 100%;
    }
    
    .confirm-modal-buttons .btn {
        width: 100%;
    }
}

/* Tablet specific */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 30px 24px;
    }
    
    .nav-menu {
        gap: 12px;
    }
    
    .form-row {
        gap: 16px;
    }
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
}

.toast-notification.success {
    border-left: 4px solid #10b981;
}

.toast-notification.error {
    border-left: 4px solid #ef4444;
}

.toast-notification.info {
    border-left: 4px solid #3b82f6;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    color: #374151;
    font-size: 14px;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}
