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

:root {
    --primary-color: #4f46e5;
    --primary-light: rgba(79, 70, 229, 0.1);
    --primary-border: rgba(79, 70, 229, 0.2);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #0ea5e9;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #374151;
    background: linear-gradient(135deg, #0ea5e9 0%, #10b981 100%);
    min-height: 100vh;
}

/* Container and layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.nav-links a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.3s, transform 0.3s;
    display: inline-flex;
    align-items: center;
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
}

.nav-links a:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.button {
    /* Base solid color - Normal State */
    background-color: #4f46e5; /* Primary Indigo Color (Adjust as desired) */
    color: white; /* White text for contrast */
    border: none;
    text-decoration: none;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
}

/* Full solid color - Hover and Focus State */
.button:hover,
.button:focus {
    background-color: #4338ca; /* Slightly darker solid color */
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
    outline: none; /* Remove default focus outline if present */
}

/* Full solid color - Active (Pressed) State */
.button:active {
    background-color: #3730a3; /* Darkest solid color for pressed state */
    transform: translateY(1px); /* Simple press effect */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Disable the complex hover effect element */
.button .hoverEffect {
    display: none !important;
}


/* Header styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header h1 {
    color: #1f2937;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #6b7280;
    font-weight: 500;
}

.user-info span {
    color: #374151;
}

#currentUserId {
    font-weight: 600;
    color: #4f46e5;
}

/* Button styles */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-set-user {
    background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
    color: white;
}

.btn-upload {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: white;
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
}

.btn-upload:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-clear {
    background: #ef4444;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
}

.btn-copy {
    background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
    color: white;
}

.btn-refresh {
    background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
    color: white;
}

.btn-cancel {
    background: #6b7280;
    color: white;
}

.btn-confirm {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: white;
}

/* Section styles */
.upload-section,
.history-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.upload-section h2,
.history-section h2 {
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 24px;
}

/* File drop zone */
.file-drop-zone {
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    position: relative;
    cursor: pointer;
    margin-bottom: 24px;
    overflow: hidden;
}

.file-drop-zone:hover {
    border-color: #9b99c5;
    background: linear-gradient(135deg, #f0f4ff 0%, #e5e7ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.file-drop-zone.dragover {
    border-color: #4f46e5;
    background: linear-gradient(135deg, #e0e7ff 0%, #dbeafe 100%);
    transform: scale(1.02);
    border-style: solid;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2), 0 8px 16px rgba(0, 0, 0, 0.1);
}

.file-drop-zone.dragover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(79, 70, 229, 0.05);
    z-index: 1;
    pointer-events: none;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }
    50% {
        opacity: 0.2;
    }
    100% {
        opacity: 0.5;
    }
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-drop-zone p {
    margin: 8px 0;
    color: #6b7280;
    font-size: 16px;
}

.file-drop-zone p:first-of-type {
    color: #374151;
    font-weight: 500;
    font-size: 18px;
}

/* Selected file display */
.selected-file {
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.selected-file span {
    color: #4f46e5;
    font-weight: 500;
}

#fileName {
    flex: 1;
    min-width: 200px;
}

#fileSize {
    color: #6b7280;
    font-size: 14px;
}

/* Form styles */
.upload-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.expiry-settings {
    background: #f8fafc;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.expiry-settings h3 {
    color: #374151;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #374151;
    font-weight: 500;
}

/* Input styles */
.custom-select,
.input-number,
.input-text {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
    transition: all 0.2s;
    outline: none;
}

.custom-select:focus,
.input-number:focus,
.input-text:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-text[readonly] {
    background-color: #f9fafb;
    color: #6b7280;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 16px;
    position: relative;
}

.progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: var(--progress-width, 0%);
    background: linear-gradient(90deg, #4f46e5 0%, #6366f1 100%);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: progressPulse 2s infinite;
    position: relative;
}

.progress-bar::after::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 5px;
    background: rgba(255, 255, 255, 0.8);
    animation: progress-pulse 1s infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes progress-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.detailed-progress {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 16px;
    padding: 8px 12px;
    background-color: #f3f4f6;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    line-height: 1.5;
    font-family: monospace;
    white-space: pre-wrap;
    transition: all 0.3s ease;
}

.detailed-progress.hidden {
    display: none;
}

/* Tooltip styles */
.tooltip {
    position: fixed;
    background-color: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 1000;
    max-width: 300px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip-icon {
    font-size: 12px;
    color: #6b7280;
    margin-left: 4px;
    cursor: help;
}

[data-tooltip] {
    position: relative;
    cursor: help;
}

.help-icon {
    font-size: 16px;
    color: var(--info-color);
    margin-left: 6px;
    cursor: help;
}

/* Info box styles */
.info-box {
    display: flex;
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    align-items: flex-start;
    gap: 12px;
}

.info-box i {
    color: var(--info-color);
    font-size: 18px;
    margin-top: 3px;
}

.info-box p {
    margin: 0 0 8px 0;
    color: #0c4a6e;
    font-size: 14px;
    line-height: 1.5;
}

.info-box p:last-child {
    margin-bottom: 0;
}

/* Security features */
.security-features {
    display: flex;
    gap: 16px;
    margin: 16px 0;
    justify-content: center;
}

.security-features span {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #4b5563;
    font-size: 14px;
}

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

/* Upload result */
.upload-result {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.upload-result h3 {
    color: #15803d;
    margin-bottom: 16px;
}

.download-link-section {
    margin-bottom: 16px;
}

.download-link-section h4 {
    color: #374151;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.download-link-section {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.download-link-section .input-text {
    flex: 1;
}

.upload-details {
    color: #6b7280;
    font-size: 14px;
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

/* History section */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.history-actions {
  display: flex;
  gap: 10px;
}

.btn-warning {
  background-color: var(--warning-color, #f0ad4e);
  color: white;
}

.history-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    min-width: 800px;
}

.history-table th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    font-weight: 600;
    color: #475569;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 18px 20px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.history-table th:first-child {
    padding-left: 24px;
    border-top-left-radius: 12px;
}

.history-table th:last-child {
    padding-right: 24px;
    border-top-right-radius: 12px;
}

.history-table td {
    padding: 20px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 14px;
    color: #334155;
}

.history-table td:first-child {
    padding-left: 24px;
}

.history-table td:last-child {
    padding-right: 24px;
}

.history-table tbody tr {
    transition: all 0.2s ease;
}

.history-table tbody tr:hover {
    background-color: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.history-table tbody tr:last-child td {
    border-bottom: none;
}

/* File column styling */
.history-table .file-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-table .file-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 15px;
}

.history-table .file-size {
    font-size: 13px;
    color: #64748b;
    font-weight: 400;
}

/* Date column styling */
.history-table .date-info {
    font-weight: 500;
    color: #475569;
    white-space: nowrap;
}

/* Downloads column styling */
.history-table .downloads-count {
    font-weight: 600;
    color: #1e293b;
    text-align: center;
}

/* Actions column styling */
.history-table .actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
}

.history-table .action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.history-table .action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.history-table .btn-view {
    background-color: #3b82f6;
    color: white;
}

.history-table .btn-view:hover {
    background-color: #2563eb;
}

.history-table .btn-delete {
    background-color: #ef4444;
    color: white;
}

.history-table .btn-delete:hover {
    background-color: #dc2626;
}

.history-table .btn-copy {
    background-color: #8b5cf6;
    color: white;
}

.history-table .btn-copy:hover {
    background-color: #7c3aed;
}

/* Status badges */
.badge {
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-content h3 {
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    min-width: 300px;
    max-width: 400px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    color: #374151;
    font-weight: 500;
}

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

.toast.success {
    border-left: 4px solid #10b981;
    background: rgba(240, 253, 244, 0.95);
}

.toast.error {
    border-left: 4px solid #ef4444;
    background: rgba(254, 242, 242, 0.95);
}

.toast.info {
    border-left: 4px solid #3b82f6;
    background: rgba(239, 246, 255, 0.95);
}

/* Utility classes */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Empty state for history table */
.history-empty {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.history-empty i {
    font-size: 48px;
    color: #cbd5e1;
    margin-bottom: 16px;
}

.history-empty h3 {
    color: #475569;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.history-empty p {
    font-size: 14px;
    color: #64748b;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .upload-section,
    .history-section {
        padding: 20px;
    }
    
    .file-drop-zone {
        padding: 30px 15px;
    }
    
    .selected-file {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .download-link-section {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .toast {
        min-width: calc(100% - 40px);
        left: 20px;
        right: 20px;
    }
    
    /* Mobile table adjustments */
    .history-container {
        border-radius: 8px;
    }
    
    .history-table {
        font-size: 13px;
        min-width: 700px;
    }
    
    .history-table th,
    .history-table td {
        padding: 12px 16px;
    }
    
    .history-table th {
        padding: 14px 16px;
        font-size: 11px;
    }
    
    .history-table .file-name {
        font-size: 14px;
    }
    
    .history-table .file-size {
        font-size: 12px;
    }
    
    .history-table .date-info {
        font-size: 13px;
    }
    
    .history-table .action-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .history-table .actions-cell {
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .btn {
        width: 100%;
        text-align: center;
    }

    .cta-buttons {
        flex-direction: column;
        /* CHANGE: Use a wider percentage width instead of a restrictive 100% of 200px */
        width: 80%; 
        /* CHANGE: Increase the maximum allowed width to prevent it from being too narrow on slightly larger phones/small tablets. */
        max-width: 300px;
    }
    
    .btn-upload {
        padding: 16px 20px;
    }
    
    .expiry-settings {
        padding: 16px;
    }
    
    .history-table th,
    .history-table td {
        padding: 6px 8px;
        font-size: 12px;
    }
}
