/*
    Theme Colors:
    - Background: #121212 (Almost Black)
    - Surface: #1e1e1e (Dark Gray)
    - Card/Form BG: #2a2a2a (Slightly Lighter Gray)
    - Primary Accent: #bb86fc (Purple)
    - Secondary Accent: #03dac6 (Teal)
    - Error: #cf6679 (Red)
    - Text: #e0e0e0 (Light Gray/White)
*/

/* --- Global Styles & Resets --- */
body {
    font-family: 'Roboto', sans-serif;
    background-color: #121212;
    color: #e0e0e0;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}

a {
    color: #bb86fc; /* Primary accent color for links */
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #03dac6; /* Secondary accent color for hover */
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Search Bar --- */
.search-container {
    margin: 20px 0;
    width: 100%;
}

#search-input {
    width: 96%;
    padding: 12px 15px;
    background-color: #2c2c2c;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 1em;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#search-input:focus {
    border-color: #03dac6;
    box-shadow: 0 0 0 3px rgba(3, 218, 198, 0.2);
}

/* --- Layout --- */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background-color: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

header {
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    margin: 0;
    font-size: 1.8em;
}

header .header-link {
    color: inherit; /* Make the main title link not look like a link */
    text-decoration: none;
}

nav a {
    margin-left: 15px;
    font-weight: 500;
}

footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #333;
    font-size: 0.9em;
    color: #888;
}

/* --- Forms --- */
.form-box {
    background-color: #2a2a2a;
    padding: 25px;
    border-radius: 8px;
    max-width: 500px;
    margin: 20px auto;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    background-color: #333;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    box-sizing: border-box;
}

.form-group input[type="file"] {
    padding: 10px;
    background-color: #333;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    width: 100%;
    box-sizing: border-box;
}

.form-group button {
    width: 100%;
    padding: 12px;
    background-color: #bb86fc;
    color: #121212;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.form-group button:hover {
    background-color: #a36ef4;
}

.form-hint {
    font-size: 0.9em;
    color: #aaa;
    text-align: center;
    margin-top: -10px;
    margin-bottom: 20px;
}

/* --- Messages & Errors --- */
.errors, .success, .info {
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    border: 1px solid;
}

.errors {
    background-color: #cf6679;
    border-color: #b00020;
    color: #121212;
}

.success {
    background-color: #03dac6;
    border-color: #018786;
    color: #121212;
}

.info {
    background-color: #1e88e5;
    border-color: #0d47a1;
    color: #fff;
}

/* --- Build Cards --- */
.builds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.build-card {
    background-color: #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.build-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: #333;
    cursor: pointer;
    transition: opacity 0.2s;
}

.build-card-content {
    padding: 15px;
    flex-grow: 1;
}

.build-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.build-card-meta {
    font-size: 0.85em;
    color: #aaa;
    margin-bottom: 15px;
}

.build-description {
    font-size: 0.95em;
    color: #ccc;
    margin-bottom: 15px;
    line-height: 1.5;
    border-left: 3px solid #444;
    padding-left: 10px;
}

.build-code-wrapper {
    position: relative;
}

.build-code {
    background-color: #333;
    padding: 10px;
    padding-right: 70px; /* Make space for the icon and counter */
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    word-break: normal;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-container {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    background-color: #444;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.copy-container:hover {
    background-color: #555;
}

.copy-icon {
    color: #e0e0e0;
}

.copy-count {
    font-size: 0.8em;
    color: #e0e0e0;
    margin-left: 6px;
    font-weight: bold;
}

/* --- Admin Panel --- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

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

.admin-table th {
    background-color: #2a2a2a;
}

.admin-table img {
    max-width: 100px;
    border-radius: 4px;
}

.admin-actions form,
.admin-actions .btn {
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
}

main section h3 {
    font-size: 1.4em;
    color: #e0e0e0;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* --- Admin Navigation --- */
.admin-nav {
    margin-bottom: 25px;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
}

.admin-nav a {
    padding: 10px 15px;
    text-decoration: none;
    color: #ccc;
    border-radius: 4px;
    margin-right: 10px;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.admin-nav a:hover {
    background-color: #333;
    color: #fff;
}

.admin-nav a.active {
    background-color: #bb86fc;
    color: #121212;
}

.admin-table .status-approved {
    color: #03dac6;
    font-weight: bold;
}

.admin-table .status-pending {
    color: #cf6679;
    font-weight: bold;
}

.admin-actions .btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.btn-approve {
    background-color: #03dac6;
    color: #121212;
}

.btn-delete {
    background-color: #cf6679;
    color: #121212;
}

.btn-edit {
    background-color: #1e88e5;
    color: #ffffff;
    text-decoration: none; /* For <a> tags styled as buttons */
}

/* --- Image Modal (Lightbox) --- */
.modal {
    display: flex; /* Use flexbox for centering */
    align-items: center;
    justify-content: center;
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    background-color: rgba(0, 0, 0, 0.9); /* Black w/ opacity */
    
    /* Animation */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    display: block;
    width: auto;
    max-width: 90%;
    max-height: 80vh; /* Make space for caption */
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.modal.visible .modal-content {
    transform: scale(1);
}

#modalCaption {
    margin-top: 15px;
    color: #ccc;
    text-align: center;
    font-size: 1.1em;
}

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

.modal-close:hover,
.modal-close:focus {
    color: #bbb;
    text-decoration: none;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }

    header h1 {
        margin-bottom: 10px;
    }

    nav {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        margin-top: 10px;
    }

    nav a {
        margin-left: 0;
        margin-right: 15px;
    }
}

/* --- Profile Page --- */
.profile-header {
    text-align: center;
    padding: 20px;
    background-color: #2a2a2a;
    border-radius: 8px;
    margin-bottom: 30px;
}

.profile-header h2 {
    margin: 0 0 10px 0;
    font-size: 2em;
}

.profile-header p {
    margin: 0;
    font-size: 1.1em;
    color: #aaa;
}
