@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;800;900&display=swap');

:root {
    --primary: #ff8c00;
    --secondary: #ffde59;
    --background: #ffb700;
    --nav-bg: #fffbf2;
    --text-dark: #003366;
    --text-muted: #6b7280;
    --badge-bg: #ffe4e6;
    --badge-text: #e11d48;
    --card-bg: #ffffff;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
}

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

html, body {
    overflow-x: hidden;
    width: 100%;
}
body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--background);
    background-image: radial-gradient(#ffa600 15%, transparent 16%), radial-gradient(#ffa600 15%, transparent 16%);
    background-size: 60px 60px;
    background-position: 0 0, 30px 30px;
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.navbar {
    background: var(--nav-bg);
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.nav-brand h1 {
    margin: 0;
    font-weight: 900;
    font-size: 2.2rem;
    -webkit-text-stroke: 1px #222;
    text-shadow: 2px 2px 0px #ffde59;
    letter-spacing: 1px;
}
.tomo-blue { color: #2e86de; }
.pattern-red { color: #ee5253; }

.nav-categories {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-pill {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 800;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
}

.nav-pill:hover, .nav-pill.active {
    background: var(--secondary);
}

.nav-actions {
    display: flex;
    gap: 12px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 800;
    font-size: 0.9rem;
    transition: transform 0.2s;
    border: 2px solid #e67e22;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: #e67e22;
}

/* Nav Buttons matching the official site */
.nav-btn {
    background-image: url('../images/btn4.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    padding: 10px 24px;
    border-radius: 40px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 800;
    transition: transform 0.2s;
    display: inline-block;
    text-align: center;
    cursor: pointer;
    border: none;
    font-family: 'Nunito', sans-serif;
    color: #003c5a;
}

.nav-btn:hover {
    transform: scale(1.05);
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
    flex: 1;
    width: 100%;
}

/* Browse Header */
.browse-header {
    text-align: center;
    margin-bottom: 40px;
    color: var(--text-dark);
}
.browse-header h2 {
    font-size: 2.8rem;
    font-weight: 900;
    margin-bottom: 10px;
}
.browse-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

.search-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}
.search-bar, .dropdown, .btn-random {
    padding: 12px 24px;
    border: none;
    border-radius: 30px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    outline: none;
}
.search-bar { width: 350px; }
.btn-random {
    background: white;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.results-count {
    display: inline-block;
    background: white;
    padding: 8px 24px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-dark);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.results-count strong {
    color: var(--primary);
    font-size: 1.1rem;
}

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

.card {
    background: var(--card-bg);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    border: 4px solid var(--secondary);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.card-img-container {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: #f0f0f0;
    border-bottom: 2px solid #f1f5f9;
}
.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.card:hover .card-img {
    transform: scale(1.05);
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.card-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--badge-bg);
    color: var(--badge-text);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 900;
    margin-bottom: 12px;
    align-self: flex-start;
    text-transform: uppercase;
}
.card-title {
    font-size: 1.3rem;
    font-weight: 900;
    margin: 0 0 8px 0;
    color: var(--text-dark);
    line-height: 1.3;
}
.card-author {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 800;
    margin-bottom: 20px;
}
.card-meta {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.card-meta .date {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 800;
}
.card-meta .likes {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 700; margin-bottom: 8px; }
.form-input {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--text-muted);
    border-radius: var(--radius-md);
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}
.form-input:focus { border-color: var(--primary); }

/* Footer */
.site-footer {
    background: var(--nav-bg);
    padding: 20px 20px;
    text-align: center;
    border-top: 1px solid rgba(0,0,0,0.05);
    margin-top: 0;
}
.site-footer h3 {
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 10px;
}
.footer-links {
    margin-bottom: 10px;
}
.footer-links a {
    color: var(--text-dark);
    text-decoration: none;
    margin: 0 15px;
    font-weight: 800;
}
.footer-links a:hover {
    text-decoration: underline;
}
.disclaimer {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0;
}
.footer-social-official {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 15px;
}
.footer-social-official a {
    color: var(--text-muted);
    transition: color 0.2s, transform 0.2s;
}
.footer-social-official a:hover {
    color: var(--primary);
    transform: translateY(-3px);
}

.discord-cta-container {
    text-align: center;
    padding: 35px 20px;
    background: #fdfbf7;
    margin-top: 50px;
}
.discord-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-dark);
    margin-bottom: 20px;
}
.btn-discord {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #5865F2;
    color: white;
    padding: 15px 40px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.2rem;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 4px 15px rgba(88, 101, 242, 0.3);
}
.btn-discord:hover {
    background: #4752C4;
    transform: translateY(-2px);
}

.community-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.stat-box {
    text-align: center;
}

.stat-box h4 {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 900;
    margin: 0 0 2px 0;
}

.stat-box span {
    color: var(--text-dark);
    font-weight: 800;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Auth Pages --- */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    width: 100%;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 50px 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    position: relative;
    z-index: 10;
}

.auth-title {
    color: var(--text-dark);
    font-size: 2rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 30px;
}

.auth-icon-top {
    display: block;
    margin: 0 auto 15px auto;
    width: 60px;
    height: 60px;
}

.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 0.9rem;
}

.auth-options label {
    color: var(--text-dark);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.auth-options a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 800;
}

.auth-bottom-link {
    text-align: center;
    margin-top: 25px;
    font-weight: 700;
    font-size: 0.95rem;
}

.auth-bottom-link a {
    color: var(--primary);
    text-decoration: none;
    margin-left: 5px;
}

.success-message {
    background: #dcfce7;
    color: #166534;
    padding: 15px;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 700;
    margin-bottom: 25px;
}

.auth-avatar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 250px;
    z-index: 1;
    opacity: 0.9;
}

.auth-avatar.left {
    left: max(5%, calc(50% - 600px));
}

.auth-avatar.right {
    right: max(5%, calc(50% - 600px));
}

/* --- Submit Page specific --- */
.submit-page-title {
    text-align: center;
    color: var(--text-dark);
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 5px;
}

.submit-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 30px;
}

.tips-box {
    background: #fdfbf7;
    border-radius: var(--radius-md);
    padding: 25px;
    margin-bottom: 30px;
}

.tips-box h3 {
    color: var(--text-dark);
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 800;
}

.tips-box ul {
    list-style-type: none;
    padding-left: 0;
}

.tips-box li {
    position: relative;
    padding-left: 15px;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.95rem;
}

.tips-box li::before {
    content: "•";
    color: var(--text-dark);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.file-upload-wrapper {
    position: relative;
}

.btn-add-photos {
    background: #fffbf2;
    border: 2px dashed #ffde59;
    color: var(--text-dark);
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 800;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.2s;
}

.btn-add-photos:hover {
    background: #ffde59;
}

.form-help-text {
    display: block;
    color: #9ca3af;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 8px;
}

.section-divider {
    border-top: 2px dashed #e5e7eb;
    margin: 30px 0;
}

/* Profile specific */
.nav-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.profile-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--secondary);
    display: flex;
    justify-content: center;
    align-items: center;
}

.profile-link {
    color: var(--text-dark);
    font-weight: 900;
    text-decoration: none;
    font-size: 1.1rem;
}

.logout-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    padding: 5px;
}

/* =========================================
   RESPONSIVE MEDIA QUERIES
   ========================================= */

/* Tablet & Smaller Laptops (max-width: 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 0 15px;
    }
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }
    .search-bar {
        width: 300px;
    }
}

/* Tablets (max-width: 900px) */
@media (max-width: 900px) {
    .navbar {
        flex-direction: column;
        padding: 1rem;
        gap: 15px;
    }
    
    .nav-categories {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px 20px;
        padding-bottom: 10px;
    }
    
    .nav-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 15px; /* Add gap between Submit and Login buttons */
    }
    
    .nav-profile {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center !important; /* Center instead of space-between to prevent extreme stretching on tablets */
        align-items: center;
        gap: 15px !important;
    }

    .profile-link {
        display: none !important; /* Hide username text to save space, keeping only the avatar */
    }
    
    .search-controls {
        flex-direction: column;
        align-items: center;
    }
    .search-bar, .dropdown, .btn-random {
        width: 100%;
        max-width: 400px;
    }
    
    .auth-avatar {
        display: none; /* Hide floating avatars on tablets */
    }
    
    .discord-cta-container {
        padding: 40px 15px;
    }
}

/* Mobile (max-width: 600px) */
@media (max-width: 600px) {
    .browse-header h2 {
        font-size: 2rem;
    }
    .browse-header p {
        font-size: 0.95rem;
        padding: 0 10px;
    }
    
    .nav-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
        white-space: nowrap;
    }
    
    .nav-pill {
        padding: 6px 14px;
        font-size: 0.85rem;
    }
    
    .grid {
        grid-template-columns: 1fr; /* Single column on mobile */
    }
    
    .card-img-container {
        height: 250px; /* Slightly taller images for single column */
    }
    
    .auth-card {
        padding: 30px 20px;
    }
    
    .auth-title {
        font-size: 1.5rem;
    }
    
    .footer-social-official {
        gap: 15px;
    }
    
    .discord-title {
        font-size: 1.5rem;
    }
    
    .btn-discord {
        padding: 12px 24px;
        font-size: 1.1rem;
    }
}

/* Pagination */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    margin-bottom: 20px;
    background: #fdfbf7;
    padding: 10px 15px;
    border-radius: 40px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.page-btn {
    background: white;
    border: 2px solid #ffde59;
    color: #003366;
    font-weight: 800;
    font-size: 1.1rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    font-family: 'Nunito', sans-serif;
}
.page-btn:hover:not(.disabled):not(.active) {
    background: #ffde59;
}
.page-btn.active {
    background: #f4a261;
    border-color: #f4a261;
    color: white;
}
.page-btn.prev, .page-btn.next {
    width: auto;
    padding: 0 20px;
    border-radius: 25px;
}
.page-btn.prev.disabled, .page-btn.next.disabled {
    background: #e2e8f0;
    border-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
}


/* Navigation Dropdown */
.nav-dropdown {
    position: relative;
    display: inline-block;
}
.nav-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card-bg, #fff);
    min-width: 180px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 1000;
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    top: 100%;
    right: 0;
    margin-top: 5px;
    border: 1px solid #eee;
}
.nav-dropdown-content a {
    color: var(--text-dark, #333);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    transition: background 0.2s;
}
.nav-dropdown-content a:hover {
    background-color: #f3f4f6;
    color: var(--primary, #f97316);
}
.nav-dropdown:hover .nav-dropdown-content {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}
