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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #333;
    --border-color: #e1e4e8;
    --hover-color: #f0f2f5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

header {
    text-align: center;
    padding: 40px 0;
    border-bottom: 3px solid var(--primary-color);
    margin-bottom: 40px;
}

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

.subtitle {
    font-size: 1.2rem;
    color: #666;
}

.contact-message {
    font-size: 0.95rem;
    color: #555;
    margin-top: 20px;
    padding: 15px 20px;
    background-color: #f0f8ff;
    border-left: 4px solid var(--secondary-color);
    border-radius: 4px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.contact-message a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
}

.contact-message a:hover {
    text-decoration: underline;
}

.file-section {
    margin-bottom: 50px;
}

.file-section h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon {
    width: 28px;
    height: 28px;
    color: var(--secondary-color);
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.images-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.file-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
}

.file-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: var(--hover-color);
}

.file-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.file-icon svg {
    width: 100%;
    height: 100%;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.file-size {
    font-size: 0.85rem;
    color: #666;
}

.image-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.image-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.image-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.image-info {
    padding: 12px;
    background: white;
}

.image-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.image-item:hover .download-btn {
    opacity: 1;
}

.download-btn:hover {
    background: white;
    transform: scale(1.1);
}

.download-btn svg {
    width: 20px;
    height: 20px;
    color: var(--secondary-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
}

#caption {
    margin: 20px auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    font-size: 1.2rem;
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #bbb;
}

footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    color: #666;
}

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

    .file-grid,
    .images-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 15px;
    }

    header {
        padding: 30px 0;
    }
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* File Action Dialog */
.dialog-overlay {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dialog-box {
    background-color: white;
    margin: 15% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

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

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

.dialog-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--primary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 400px;
}

.dialog-close {
    color: #999;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.dialog-close:hover,
.dialog-close:focus {
    color: #333;
}

.dialog-body {
    padding: 25px;
}

.dialog-body p {
    margin: 0;
    color: #666;
    font-size: 1rem;
}

.dialog-actions {
    display: flex;
    gap: 15px;
    padding: 20px 25px;
    background-color: #f8f9fa;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 12px 12px;
}

.btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn svg {
    width: 20px;
    height: 20px;
}

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

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

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

.btn-secondary:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

@media (max-width: 768px) {
    .dialog-box {
        margin: 30% auto;
        width: 95%;
    }

    .dialog-header h3 {
        font-size: 1.1rem;
        max-width: 250px;
    }

    .dialog-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
