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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    direction: rtl;
    color: #333;
}

/* Header styles */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

header h1 {
    color: #4a5568;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Button styles */
.btn {
    display: inline-block;
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
    font-size: 1rem;
    margin: 0.5rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(79, 172, 254, 0.4);
    background: linear-gradient(45deg, #00f2fe, #4facfe);
}

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

/* Content container */
content {
    display: block;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Grid layout for images */
ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

/* Image card styles */
li {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-align: center;
}

li:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Image styles */
li img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    border-radius: 10px;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

li img:hover {
    transform: scale(1.05);
}

/* Link styles */
li a {
    display: block;
    color: #4a5568;
    text-decoration: none;
    margin-bottom: 1rem;
    font-weight: 500;
    word-break: break-all;
    padding: 0.5rem;
    background: #f7fafc;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

li a:hover {
    background: #edf2f7;
    color: #2d3748;
}

/* Copy button specific styles */
li button.btn {
    font-size: 0.9rem;
    padding: 8px 16px;
    margin: 0;
    width: 100%;
}

/* Responsive design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    content {
        padding: 0 1rem;
    }

    ul {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem 0;
    }

    li {
        padding: 1rem;
    }

    li img {
        height: 180px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5rem 0;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    li {
        padding: 1rem;
        margin: 0 0.5rem;
    }
}

/* Loading state animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

li {
    animation: fadeInUp 0.6s ease-out;
}

/* Success state for copy button */
.btn.success {
    background: linear-gradient(45deg, #48bb78, #68d391) !important;
}

/* Focus states for accessibility */
.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.3);
}

li a:focus {
    outline: none;
    background: #e2e8f0;
    box-shadow: 0 0 0 2px rgba(79, 172, 254, 0.3);
}

.upload-container {
    max-width: 500px;
    margin: 2rem auto;
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.upload-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #4a5568;
}

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

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

.form-group input[type="password"],
.form-group input[type="file"],
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    direction: rtl;
}

.form-group input[type="password"]:focus,
.form-group input[type="file"]:focus,
.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

/* Select element specific styling */
.form-group select {
    background: white;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 16px;
    padding-left: 40px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.form-group select:hover {
    border-color: #cbd5e0;
}

.form-group select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234facfe' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* Select option styling */
.form-group select option {
    padding: 8px 12px;
    background: white;
    color: #4a5568;
    font-size: 1rem;
}

.form-group select option:hover,
.form-group select option:focus {
    background: #f7fafc;
}

.form-group select option:disabled {
    color: #a0aec0;
    background: #f7fafc;
}

/* Multi-select styling */
.form-group select[multiple] {
    background-image: none;
    padding-left: 12px;
    min-height: 120px;
}

.file-info {
    background: #f7fafc;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #4a5568;
}

.message {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
}

.message-success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.message-error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
}

.message-info {
    background: #bee3f8;
    color: #2a4365;
    border: 1px solid #90cdf4;
}

.upload-actions {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 2rem;
}

.upload-actions .btn {
    flex: 1;
}

.logout-link {
    color: #e53e3e;
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 1rem;
    display: inline-block;
}

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

.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    color: #4facfe;
    text-decoration: none;
    font-weight: 500;
}

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

.preview-container {
    margin: 1rem 0;
    text-align: center;
}

.preview-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.preview-image:hover {
    transform: scale(1.02);
}

/* Text file preview */
.text-preview {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    text-align: left;
    white-space: pre-wrap;
    color: #495057;
}

/* File info for non-previewable files */
.file-info {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.file-icon {
    font-size: 3rem;
    opacity: 0.7;
}

.file-details {
    flex: 1;
    text-align: left;
}

.file-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.file-type {
    color: #718096;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.file-size {
    color: #4a5568;
    font-size: 0.875rem;
    font-weight: 500;
}

/* General preview content container */
.preview-content {
    margin: 1rem 0;
}

/* Upload page specific enhancements */
.upload-container form {
    width: 100%;
}

.upload-container .message {
    animation: slideInFromTop 0.3s ease-out;
    transition: opacity 0.3s ease;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Improved mobile responsiveness for upload form */
@media (max-width: 480px) {
    .upload-container {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .upload-actions {
        flex-direction: column;
    }
    
    .form-group input[type="password"],
    .form-group input[type="file"],
    .form-group input[type="text"],
    .form-group select {
        padding: 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .form-group select {
        padding-left: 42px;
        background-position: left 14px center;
    }
}

/* Tabbed Interface Styles */
.tab-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    margin: 0 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    min-height: 70vh;
}

.tab-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 2px solid transparent;
    border-radius: 25px;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
    min-width: fit-content;
}

.tab-btn:hover {
    background: linear-gradient(145deg, #e9ecef, #dee2e6);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.tab-btn.active {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    color: white;
    border-color: rgba(79, 172, 254, 0.3);
    box-shadow: 0 5px 20px rgba(79, 172, 254, 0.4);
}

.tab-icon {
    font-size: 1.2rem;
}

.tab-label {
    font-size: 1rem;
}

.tab-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.tab-btn.active .tab-count {
    background: rgba(255, 255, 255, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* File Grid Layout */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.file-item {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.file-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #4facfe;
}

.file-preview {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
}

.file-preview img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

.file-preview video {
    width: 100%;
    height: 150px;
    border-radius: 8px;
    background: #000;
}

/* Audio Preview */
.audio-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem 1rem;
    border-radius: 8px;
    color: white;
    text-align: center;
}

.audio-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.audio-preview audio {
    width: 100%;
    margin-top: 1rem;
}

/* Document Preview */
.document-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 2rem 1rem;
    border-radius: 8px;
    color: white;
    text-align: center;
    min-height: 150px;
    justify-content: center;
}

.document-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.document-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.document-ext {
    font-size: 0.8rem;
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
}

/* File Info */
.file-info {
    text-align: center;
}

.file-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.75rem;
    word-break: break-word;
    font-size: 0.9rem;
}

.file-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.btn-small {
    padding: 0.5rem 1rem !important;
    font-size: 0.8rem !important;
    margin: 0 !important;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #718096;
    grid-column: 1 / -1;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    color: #4a5568;
}

.empty-state p {
    font-size: 1rem;
    opacity: 0.8;
}

/* Responsive Design for Tabs */
@media (max-width: 768px) {
    .tab-container {
        margin: 0 1rem;
        padding: 1rem;
    }
    
    .tab-nav {
        gap: 0.5rem;
    }
    
    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .tab-icon {
        font-size: 1rem;
    }
    
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .file-preview img,
    .file-preview video {
        height: 120px;
    }
    
    .audio-preview,
    .document-preview {
        min-height: 120px;
    }
}

@media (max-width: 480px) {
    .tab-nav {
        flex-wrap: wrap;
    }
    
    .file-grid {
        grid-template-columns: 1fr;
    }
    
    .file-actions {
        flex-direction: column;
    }
    
    .tab-btn {
        flex: 1;
        min-width: calc(50% - 0.25rem);
    }
}