/* CSS Variables for consistent theming */
:root {
    --primary-color: #7FDBDA; /* Robin's egg blue */
    --primary-dark: #5BC0BE;
    --primary-light: #A8E6CF;
    --bg-dark: #1a1a1a;
    --bg-darker: #0f0f0f;
    --bg-light: #2a2a2a;
    --bg-lighter: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #888888;
    --border-color: #404040;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --danger-color: #f44336;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.4);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation */
.navbar {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-brand i {
    font-size: 1.8rem;
}

.nav-menu {
    display: flex;
    gap: 20px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color);
    background: rgba(127, 219, 218, 0.1);
}

/* Main content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Flash messages */
.flash-messages {
    margin-bottom: 20px;
}

.flash-message {
    background: var(--warning-color);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-lighter);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--bg-dark);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--bg-lighter);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* Hero section */
.hero-section {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, rgba(127, 219, 218, 0.1) 0%, rgba(168, 230, 207, 0.1) 100%);
    border-radius: 20px;
    margin-bottom: 60px;
}

.hero-icon {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.hero-title {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.feature i {
    color: var(--primary-color);
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* Info section */
.info-section {
    padding: 60px 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.info-card {
    background: var(--bg-light);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
}

.info-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.info-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.info-card p {
    color: var(--text-secondary);
}

/* Login page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 70px);
    padding: 20px;
}

.login-card {
    background: var(--bg-light);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.login-header h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-secondary);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-lighter);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(127, 219, 218, 0.1);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Dashboard */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 40px;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.dashboard-section {
    background: var(--bg-light);
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.dashboard-section.full-width {
    grid-column: 1 / -1;
}

.section-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-size: 1.3rem;
}

/* Upload area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(127, 219, 218, 0.05);
}

.upload-content i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.upload-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.upload-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-lighter);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

/* Create link form */
.create-link-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.file-selector {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    background: var(--bg-lighter);
}

.file-item {
    margin-bottom: 10px;
}

.file-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.file-item label:hover {
    background: rgba(127, 219, 218, 0.1);
}

.file-item input[type="checkbox"] {
    accent-color: var(--primary-color);
}

/* Files and links containers */
.files-container,
.links-container {
    display: grid;
    gap: 15px;
}

.file-card,
.link-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-lighter);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.file-card:hover,
.link-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.file-info,
.link-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.file-info i,
.link-info i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.file-info h4,
.link-info h4 {
    margin-bottom: 5px;
    color: var(--text-primary);
}

.file-info p,
.link-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.link-url {
    font-family: monospace;
    background: var(--bg-dark);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    word-break: break-all;
}

.link-dates {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-actions,
.link-actions {
    display: flex;
    gap: 10px;
}

/* Download page */
.download-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 70px);
    padding: 20px;
}

.download-card {
    background: var(--bg-light);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 600px;
}

.download-header {
    text-align: center;
    margin-bottom: 30px;
}

.download-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.download-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.download-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.download-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-lighter);
    border-radius: 12px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.info-item i {
    color: var(--primary-color);
    width: 20px;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.files-list .file-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--bg-lighter);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 1;
    min-width: 0;
}

.file-preview-img,
.file-preview-video {
    flex-shrink: 0;
    width: 120px;
    height: 90px;
    border-radius: 8px;
    object-fit: cover;
    background: #222;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: block;
    margin-bottom: 0;
}

.file-preview-video {
    background: #111;
    border: 2px solid var(--primary-color);
}

.file-info > div {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.files-list .file-info h3 {
    margin-bottom: 5px;
    color: var(--text-primary);
    font-size: 1.1rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.files-list .file-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    word-break: break-all;
    margin: 0;
}

.download-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* Error page */
.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 70px);
    padding: 20px;
}

.error-card {
    background: var(--bg-light);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow);
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.error-icon {
    font-size: 4rem;
    color: var(--danger-color);
    margin-bottom: 20px;
}

.error-card h1 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.error-card p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.error-actions {
    display: flex;
    justify-content: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--bg-light);
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-hover);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--bg-lighter);
    color: var(--text-primary);
}

.modal-body {
    padding: 25px;
}

/* Stats section */
.stats-container {
    padding-top: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px; /* Added space */
}

.stats-grid-full-width {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.stat-card {
    background: var(--bg-lighter);
    padding: 20px;
    border-radius: 12px;
}

.stat-card h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.stat-card .stat-big-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-card ul {
    list-style: none;
    padding: 0;
}

.stat-card li {
    padding: 5px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-card li:last-child {
    border-bottom: none;
}

.table-container {
    overflow-x: auto;
}

.stats-container table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto; /* Changed from fixed */
}

.stats-container th,
.stats-container td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap; /* Default to nowrap */
}

.stats-container th {
    color: var(--text-secondary);
    font-weight: 600;
}

.stats-container td {
    color: var(--text-primary);
}

/* Set specific column widths */
.stats-container th:nth-child(1), .stats-container td:nth-child(1) { width: 20%; }
.stats-container th:nth-child(2), .stats-container td:nth-child(2) { width: 20%; }
.stats-container th:nth-child(3), .stats-container td:nth-child(3) { width: 15%; }
.stats-container th:nth-child(4), .stats-container td:nth-child(4) { width: 45%; }


.stats-container table tr:last-child td {
    border-bottom: none;
}

.stats-container .user-agent-cell {
    white-space: normal; /* Allow wrapping */
    word-break: break-all;
}


/* Utility classes */
.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-style: italic;
}

/* Responsive design */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 15px;
    }
    
    .nav-brand span {
        display: none;
    }
    
    .nav-menu {
        gap: 10px;
    }
    
    .nav-link span {
        display: none;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-features {
        flex-direction: column;
        gap: 15px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-section {
        padding: 20px;
    }
    
    .file-card,
    .link-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .file-actions,
    .link-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .files-list .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .files-list .file-item .btn {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 15px;
    }
    
    .hero-section {
        padding: 40px 15px;
    }
    
    .login-card,
    .download-card,
    .error-card {
        padding: 25px;
    }
    
    .dashboard-header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 600px) {
    .files-list .file-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .file-info {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    .file-preview-img,
    .file-preview-video {
        width: 120px;
        height: 90px;
        margin: 0 auto 10px auto;
        display: block;
    }
    .file-info > div {
        align-items: center;
        text-align: center;
    }
    .files-list .file-info h3 {
        white-space: normal;
        word-break: break-all;
    }
} 