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

body {
    font-family: 'Arial', sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    line-height: 1.6;
}

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

/* Navigation */
.navbar {
    background: #2d2d2d;
    padding: 1rem 0;
    border-bottom: 2px solid #444;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
}

.logo {
    height: 40px;
    width: auto;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-menu a {
    color: #e0e0e0;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-menu a:hover {
    background-color: #444;
}

/* Flexible Mod Cards - No Fixed Height */
.mods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    padding: 20px 0;
}

.mod-card {
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 150px; /* Only minimum height */
    overflow: hidden;
}

.mod-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
    border-color: #555;
}

.mod-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.mod-icon {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.mod-name {
    font-size: 1.1rem;
    color: #fff;
    margin: 0;
    line-height: 1.2;
    font-weight: 600;
    flex-grow: 1;
}

.mod-description {
    color: #b0b0b0;
    margin-bottom: 15px; /* More space before button */
    line-height: 1.3;
    font-size: 0.85rem;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Show 3 lines max */
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 40px;
}

.mod-actions {
    margin-top: auto; /* Push button to bottom */
    flex-shrink: 0;
}

.mod-actions .btn {
    padding: 10px 16px;
    font-size: 0.85rem;
    width: 100%;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    color: white;
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
}

.mod-actions .btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Mod Icon Placeholder */
.mod-icon-placeholder {
    width: 50px;
    height: 50px;
    background: #3d3d3d;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* Ensure button is always visible */
.mod-card::after {
    content: '';
    flex-grow: 1;
    min-height: 10px;
}

/* No Mods State */
.no-mods {
    text-align: center;
    padding: 30px 20px;
    grid-column: 1 / -1;
    background: #2d2d2d;
    border-radius: 8px;
    border: 1px solid #444;
}

.no-mods h2 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.no-mods p {
    color: #b0b0b0;
    margin-bottom: 15px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #555;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn:hover {
    background: #666;
}

.btn-primary {
    background: #007bff;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-danger {
    background: #dc3545;
}

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

/* Clickable site title */
.site-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-title:hover {
    color: #667eea;
}

/* Fixed Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    overflow: hidden;
}

.modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal-image {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    background: rgba(0,0,0,0.7);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close:hover {
    background: rgba(255,0,0,0.7);
    transform: scale(1.1);
}

.prev, .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    transition: 0.3s;
    user-select: none;
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.prev {
    left: 20px;
}

.next {
    right: 20px;
}

.prev:hover, .next:hover {
    background: rgba(0,0,0,0.9);
    transform: translateY(-50%) scale(1.1);
}

/* Gallery thumbnails */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.gallery-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.gallery-thumb:hover {
    transform: scale(1.05);
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    color: #fff;
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 10px;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Admin */
.admin-actions {
    margin: 20px 0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #2d2d2d;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #444;
}

.admin-table th {
    background: #3d3d3d;
    color: #fff;
}

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

.flash {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 10px;
}

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

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

/* Drag and drop */
.draggable-list {
    list-style: none;
}

.draggable-item {
    background: #2d2d2d;
    padding: 15px;
    margin: 10px 0;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: move;
    display: flex;
    align-items: center;
    gap: 15px;
}

.draggable-item img {
    width: 100px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.dragging {
    opacity: 0.5;
}

/* Additional styles for new templates */

/* Mod detail page specific */
.mod-detail {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 20px;
}

.mod-header {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #444;
}

.mod-icon-large {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.mod-info h1 {
    font-size: 2.2rem;
    color: #fff;
    margin-bottom: 10px;
}

.mod-description-brief {
    font-size: 1.1rem;
    color: #b0b0b0;
    line-height: 1.5;
}

.gallery-section {
    margin: 30px 0;
}

.gallery-section h2 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 15px;
}

.detailed-description {
    margin: 30px 0;
}

.detailed-description h2 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 15px;
}

.description-content {
    background: #2d2d2d;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #444;
    line-height: 1.6;
}

.back-button {
    margin-top: 30px;
    text-align: center;
}

/* Server Info Page */
.server-info-page {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

.server-info-page h1 {
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 30px;
    text-align: center;
}

.server-info-content {
    background: #2d2d2d;
    padding: 40px;
    border-radius: 8px;
    border: 1px solid #444;
    min-height: 300px;
}

.no-info {
    text-align: center;
    color: #b0b0b0;
    font-size: 1.1rem;
}

.no-info a {
    color: #007bff;
}

/* Admin Forms */
.login-form, .admin-edit-mod, .admin-settings {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.admin-form {
    background: #2d2d2d;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #444;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

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

/* Current files display */
.current-file {
    margin-top: 15px;
    padding: 15px;
    background: #3d3d3d;
    border-radius: 4px;
}

.current-image {
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    border-radius: 4px;
    margin-top: 10px;
}

.current-image-small {
    max-width: 100px;
    max-height: 100px;
    object-fit: cover;
    border-radius: 4px;
    margin-top: 10px;
}

/* Screenshots list */
.screenshots-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.screenshot-item {
    background: #3d3d3d;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #555;
}

.screenshot-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.screenshot-actions {
    text-align: center;
}

/* Table styles */
.table-icon {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.no-icon {
    color: #777;
    font-style: italic;
}

.description-cell {
    max-width: 200px;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    margin: 2px;
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* Demo info */
.demo-info {
    background: #2d2d2d;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #444;
    margin-top: 30px;
    text-align: center;
}

.demo-info p {
    margin: 5px 0;
}

/* Error messages */
.error {
    color: #dc3545;
    font-size: 0.9rem;
    margin-top: 5px;
    display: block;
}

/* Navigation Styles */
.navbar {
    background: #2d2d2d;
    padding: 0;
    border-bottom: 2px solid #444;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
}

.logo {
    height: 50px;
    width: auto;
    border-radius: 4px;
}

.site-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 5px;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.nav-link {
    display: inline-block;
    color: #e0e0e0;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    font-weight: 500;
}

.nav-link:hover {
    background-color: #3d3d3d;
    border-color: #555;
    color: #fff;
}

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

.nav-link.admin-link:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
}

.nav-link.logout-link {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.nav-link.logout-link:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    transform: translateY(-2px);
}

/* Responsive Navigation */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        padding: 10px;
    }
    
    .nav-brand {
        padding: 10px 0;
    }
    
    .nav-menu {
        width: 100%;
        justify-content: center;
        gap: 10px;
    }
    
    .nav-link {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .nav-menu {
        flex-direction: column;
        align-items: center;
    }
    
    .nav-link {
        width: 200px;
        text-align: center;
    }
}

/* Button Styles Update */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: #555;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    border: 1px solid transparent;
}

.btn:hover {
    background: #666;
    border-color: #777;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

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

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

.btn-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
}

/* Form Styles Update */
.admin-form {
    background: #2d2d2d;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #444;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.form-control {
    width: 100%;
    padding: 12px;
    background: #3d3d3d;
    border: 1px solid #555;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Ensure settings are passed to all templates */
/* We'll modify the before_request to ensure settings are available everywhere */
/* Page Header */
.page-header {
    text-align: center;
    margin: 40px 0;
    padding: 30px;
    background: #2d2d2d;
    border-radius: 8px;
    border: 1px solid #444;
}

.page-header h1 {
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 10px;
}

.page-header p {
    font-size: 1.2rem;
    color: #b0b0b0;
}

/* No Mods State */
.no-mods {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}

.no-mods h2 {
    color: #fff;
    margin-bottom: 15px;
}

.no-mods p {
    color: #b0b0b0;
    margin-bottom: 25px;
}

/* Mod Icon Placeholder */
.mod-icon-placeholder {
    width: 60px;
    height: 60px;
    background: #3d3d3d;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

/* Mod Actions */
.mod-actions {
    margin-top: auto;
}

/* Admin mods reordering */
.admin-mods-list {
    margin: 20px 0;
}

.draggable-mod {
    background: #2d2d2d;
    padding: 15px;
    margin: 10px 0;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: move;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.draggable-mod:hover {
    border-color: #667eea;
    background: #3d3d3d;
}

.draggable-mod.dragging {
    opacity: 0.5;
    background: #3d3d3d;
}

.drag-handle {
    cursor: move;
    color: #b0b0b0;
    font-size: 1.2rem;
    padding: 5px;
}

.drag-handle:hover {
    color: #fff;
}

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

.mod-info h4 {
    margin: 0 0 5px 0;
    color: #fff;
}

.mod-info p {
    margin: 0;
    color: #b0b0b0;
    font-size: 0.9rem;
}

.mod-actions-admin {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.table-icon {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mods-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 12px;
    }
    
    .mod-card {
        padding: 12px;
        min-height: 140px;
    }
    
    .mod-header {
        gap: 10px;
        margin-bottom: 8px;
    }
    
    .mod-icon {
        width: 45px;
        height: 45px;
    }
    
    .mod-name {
        font-size: 1rem;
    }
    
    .mod-description {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
        margin-bottom: 12px;
    }
    
    .mod-actions .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .mods-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }
    
    .mod-card {
        padding: 10px;
        min-height: 130px;
    }
    
    .mod-header {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .mod-icon {
        width: 40px;
        height: 40px;
    }
    
    .mod-name {
        font-size: 0.9rem;
    }
    
    .mod-description {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
        text-align: center;
        margin-bottom: 10px;
    }
}