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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.header-with-back {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
    justify-content: space-between;
    flex-wrap: wrap;
}

.back-btn {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    transition: background 0.3s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.card h2 {
    color: #333;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-repo {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-repo:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    border: 2px solid #f0f0f0;
    border-radius: 10px;
    padding: 1.5rem;
    transition: all 0.3s;
}

.project-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.project-header h3 {
    color: #333;
    margin: 0;
}

.project-actions {
    display: flex;
    gap: 0.5rem;
}

.project-description {
    color: #666;
    margin-bottom: 1rem;
    font-style: italic;
}

.project-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat {
    font-size: 0.9rem;
    color: #777;
}

/* Structure Display */
.structure-item {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.structure-header {
    background: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.structure-header h3 {
    margin: 0 0 0.5rem 0;
    color: #333;
    flex: 1;
}

.structure-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #666;
}

.download-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.structure-content {
    padding: 1rem;
}

.file-tree {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 5px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    max-height: 400px;
    overflow-y: auto;
}

.tree-folder,
.tree-file {
    margin: 0.2rem 0;
    padding-left: 1rem;
}

.tree-folder {
    color: #0066cc;
    font-weight: 600;
}

.tree-file {
    color: #333;
}

/* Files List */
.files-list {
    max-height: 600px;
    overflow-y: auto;
}

.file-group {
    margin-bottom: 2rem;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
}

.file-group h4 {
    background: #f8f9fa;
    margin: 0;
    padding: 1rem;
    border-bottom: 1px solid #e1e5e9;
    color: #555;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.file-item:last-child {
    border-bottom: none;
}

.file-info {
    flex-grow: 1;
}

.file-name {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

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

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

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    background: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-body pre {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 5px;
    padding: 1rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 1rem;
}

.no-projects {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* Upload Form */
.upload-form {
    background: #f8f9fa;
    border: 2px dashed #d1ecf1;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 1.5rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .project-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .project-actions {
        justify-content: flex-start;
    }
    
    .file-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .file-actions {
        justify-content: center;
    }
    
    .header-with-back {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        align-items: center;
    }
    
    .header-with-back > div {
        order: 1;
    }
    
    .header-with-back .back-btn {
        order: 0;
    }
    
    .header-with-back .btn-repo {
        order: 2;
    }
    
    .structure-header {
        flex-direction: column;
        gap: 1rem;
        text-align: left;
    }
    
    .download-options {
        justify-content: flex-start;
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}