/* General Body and Layout */
body {
    font-family: Arial, sans-serif;
    background-color: #1e1e2f;
    color: #c8d0d8;
    padding: 20px;
    line-height: 1.6;
    letter-spacing: 0.5px;
}

/* Navigation Bar */
header {
    background: #2b2b3c;
    padding: 15px 0;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.nav-links li {
    display: inline;
}

.nav-links a {
    text-decoration: none;
    color: #c8d0d8;
    font-weight: bold;
    font-size: 1rem;
    padding: 10px 15px;
    border-radius: 5px;
    transition: background 0.3s ease, color 0.3s ease;
}

.nav-links a:hover {
    background-color: #3a3a50;
    color: #ffcc00;
}

/* Search Bar and Icon */
.search-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    z-index: 1000;
}

.search-bar {
    display: none;
    padding: 8px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-left: 8px;
    background-color: #2b2b3c;
    color: #fff;
    transition: width 0.3s ease;
}

.search-container:hover .search-bar {
    display: inline-block;
}

/* Search Icon */
.search-icon {
    width: 24px;
    height: 24px;
    cursor: pointer;
    transition: transform 0.3s ease;
    fill: white;
}

/* Work Grid and Layout */
.works {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    justify-content: space-around;
    padding: 20px 0;
    margin: 0 auto;
    max-width: 95%;
}

.work {
    background-color: #2b2b3c;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.work h2 {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    margin-bottom: 10px;
    color: #dcdfe6;
    text-align: left;
    width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    hyphens: auto;
    white-space: normal;
}

.work:hover {
    transform: scale(1.05);
}

.work-image {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
}

/* Chapters Container */
.chapters-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 0;
    overflow-y: auto;
    padding-right: 10px;
    border: 2px solid #2b2b3c;
    border-radius: 10px;
    padding: 10px;
    background-color: #1e1e2f;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.work:hover .chapters-container {
    max-height: 40vh;
    opacity: 1;
    pointer-events: auto;
}

/* Scrollbar styles */
.chapters-container::-webkit-scrollbar {
    width: 5px;
}

.chapters-container::-webkit-scrollbar-thumb {
    background-color: #666;
    border-radius: 10px;
}

.chapters-container::-webkit-scrollbar-track {
    background-color: transparent;
}

.chapter {
    color: #b0b0b0;
    text-decoration: none;
    display: block;
    margin: 5px 0;
    transition: all 0.3s ease;
}

.chapter:hover {
    text-decoration: underline;
    color: #e0e0e0;
}

.chapter:focus {
    outline: 3px solid #ff6f61;
}

/* Mobile Styling */
@media (max-width: 600px) {
    .works {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 10px;
    }

    .work {
        margin: 0 10px;
        max-width: calc(100% - 20px);
    }
}

/* Error Styling */
.error-content {
    padding: 2rem;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-card {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.error-title {
    color: #e74c3c;
    margin-bottom: 1.5rem;
}

.error-message {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 2rem;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.error-button {
    padding: 0.8rem 1.5rem;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s ease;
}

.error-button:hover {
    background: #2980b9;
}

.error-stack {
    text-align: left;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    color: #dc3545;
    margin: 1rem 0;
    font-family: monospace;
    white-space: pre-wrap;
}

/* Support Page Styling */
.support-container {
    max-width: 600px;
    width: 90%;
    /* Responsive width */
    margin: 50px auto;
    padding: 30px;
    background-color: #2b2b3c;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    text-align: center;
}

/* Form Inputs & Textarea */
.support-container .form-group {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.support-container .form-group label {
    font-size: 1rem;
    color: #c8d0d8;
    margin-bottom: 5px;
}

.support-container .form-group input,
.support-container .form-group textarea {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    background-color: #1e1e2f;
    border: 1px solid #555;
    border-radius: 8px;
    color: #fff;
    transition: border 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    /* Ensures proper spacing */
}

/* Fix for Message Box Stretching */
.support-container .form-group textarea {
    resize: none;
    /* Prevent resizing */
    min-height: 150px;
    /* Set a good height */
    max-width: 100%;
    /* Prevent overflowing */
}

/* Focus Effect */
.support-container .form-group input:focus,
.support-container .form-group textarea:focus {
    border-color: #ffcc00;
    outline: none;
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.8);
}

/* Submit Button */
.support-container .support-button {
    padding: 12px;
    background: #ffcc00;
    color: #1e1e2f;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;

    /* Fix misalignment */
    margin-top: 15px;
    /* Space between textarea and button */
    display: block;
    width: fit-content;
    /* Keep button size consistent */
    margin-left: auto;
    margin-right: auto;
}

.support-container .support-button:hover {
    background: #e6b800;
    transform: scale(1.05);
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .support-container {
        margin: 20px;
        padding: 20px;
    }
}