/* --- VARIABLES --- */

:root {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --primary: #22c55e;
    --primary-hover: #16a34a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --accent: #fbbf24;
}

/* --- BASE --- */

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding-bottom: 50px;
}

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

.d-none {
    display: none !important;
}

.text-center {
    text-align: center;
    justify-content: center;
}

.object-fit-cover {
    object-fit: cover;
}

.mt-1 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 1rem;
}

.fs-1 {
    font-size: 1.1rem;
}


.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
    margin-bottom: 2rem;
}

.container-v2 {
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.container-v3 {
    max-width: 900px;
    margin: 3rem auto;
    padding: 0 5%;
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary);
    text-decoration: none;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

header,
.nav-actions {
    position: sticky;
    /* ou fixed */
    top: 0;
    z-index: 10000 !important;
    /* Um valor maior que o 9999 do select2 */
}


.nav-actions {
    display: flex;
    gap: 1rem;
}

/* 
   -- COMPONENTS --
*/

.hero {
    text-align: center;
    padding: 4rem 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    letter-spacing: -1px;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
}


/* --- BUTTONS --- */

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
}

.btn:disabled {
    background: #334155;
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
    transform: none;
}

.btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.4);
}


.btn-primary {
    background-color: var(--primary);
    color: white;
}

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

.btn-group {
    width: 100%;
    display: block;
    text-align: center;
    padding: 0.8rem;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.9) !important;
    color: #0f172a !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-outline-primary:hover {
    background-color: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
    transform: translateY(-3px);
    box-shadow: var(--shadow-primary);
}

.btn-outline-primary:hover i {
    color: #ffffff;
}

.btn-github {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #0f172a;
    color: var(--text-main);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    border: 1px solid var(--border);
    transition: 0.3s;
    font-weight: 600;
}

.btn-github:hover {
    border-color: var(--primary);
    background: #1e293b;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.btn-github i {
    font-size: 1.4rem;
}

.grid-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.card-image {
    width: 100%;
    height: 180px;
    background: #2d3748;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5568;
    font-size: 3rem;
}

.card-content {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
    height: auto;
}

.page-header {
    text-align: center;
    padding: 3rem 1rem;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.page-header p {
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* --- Select2 --- */

.wrapper-select2 {
    display: block;
    position: relative;
    width: 100%;
}

.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    height: 50px !important;
    display: flex;
    align-items: center;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}

.select2-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    pointer-events: none;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-main) !important;
    padding-left: 3rem !important;
    line-height: 50px !important;
    font-size: 0.95rem;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--primary) !important;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(34, 197, 94, 0.25) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 48px !important;
    right: 10px !important;
    width: 30px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    display: none !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow::after {
    content: '\f078';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.8rem;
    color: var(--text-muted);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.3s ease;
}

.select2-container--open .select2-selection__arrow::after {
    transform: translate(-50%, -50%) rotate(180deg);
}

.select2-dropdown {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
    overflow: hidden;
    z-index: 9999;
}

.select2-container--default .select2-results__option {
    padding: 10px 15px !important;
    font-size: 0.95rem;
    color: var(--text-muted);
    background-color: transparent;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--border) !important;
    color: var(--text-main) !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--bg-body) !important;
    color: var(--primary) !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--bg-body) !important;
    border: 1px solid var(--border) !important;
    color: white !important;
    border-radius: 8px !important;
    padding: 8px !important;
    margin-bottom: 5px;
}


/* --- CATEGORIES --- */

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.category-tag {
    background: rgba(34, 197, 94, 0.1);
    color: var(--primary);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 0.8em;
}

.category-tag-v2 {
    position: absolute;
    top: 140px;
    left: 10px;
    z-index: 10;
    background: #18260f;
    color: #ffffff;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0;
}


.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.category-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    background: #232f45;
}

.icon-wrapper {
    width: 70px;
    height: 70px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
    color: var(--primary);
    font-size: 1.8rem;
    transition: 0.3s;
}

.category-card:hover .icon-wrapper {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.category-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.count-badge {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    background: var(--border);
    color: var(--text-muted);
}

.has-items {
    background: rgba(34, 197, 94, 0.2);
    color: var(--primary);
}

/* --- PAGINATION --- */

.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 45px;
    padding: 0 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
}

.pagination-item:hover:not(.disabled) {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-3px);
}

.pagination-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.pagination-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--text-muted);
}

.pagination-item i {
    font-size: 0.8rem;
}

/* --- FOOTER --- */

footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 4rem 0 0 0;
    margin-top: 5rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
    margin-bottom: 2rem;
}

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


.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    padding-bottom: 3rem;
}

.footer-description {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 450px;
    margin-top: 1rem;
    line-height: 1.8;
}

.footer-title {
    color: var(--text-main);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    text-align: center;
    background: rgba(15, 23, 42, 0.5);
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-bottom a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* --- ALERTS --- */

.alert {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid transparent;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* --- SPINNER --- */

.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.spinner-border-custom {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

.spinner-primary {
    border: 3px solid rgba(34, 197, 94, 0.1);
    border-top: 3px solid var(--primary);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.15);
}

.spinner-light {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #ffffff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/** --- EMPTY CONTENT --- */

#empty-state {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 450px;
    background: radial-gradient(circle at center, #22c55e0d 0%, #0f172a00 70%);
}

.empty-content {
    max-width: 450px;
    padding: 3rem;
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--border);
    position: relative;
    box-shadow: 0 20px 40px #0000004d;
    overflow: hidden;
}

.empty-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.empty-icon {
    font-size: 4rem;
    background: linear-gradient(135deg, var(--primary), #4ade80);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
    display: inline-block;
}

#empty-state h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

#empty-state p {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    line-height: 1.6;
    font-size: 1.05rem;
}

.empty-content {
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.empty-content:hover {
    transform: translateY(-5px);
    border-color: rgba(34, 197, 94, 0.4);
}

/* --- RESPONSIVENESS --- */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.2rem;
    }

    header {
        padding: 1rem 5%;
    }

    .nav-actions .btn-outline {
        display: inline-flex; 
        align-items: center;
        padding: 0.5rem 0.8rem;
    }

    .nav-actions .btn-primary {
        padding: 0.5rem 0.8rem;
    }

    .nav-actions {
        gap: 0.5rem; 
    }

    .logo span {
        display: none;
    }

    .logo i {
        font-size: 1.8rem;
    }

    .category-grid {
        grid-template-columns: 1fr; 
        gap: 2rem;
    }

    .category-card {
        padding: 1.2rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }

    .footer-description {
        margin: 1rem auto 0;
    }

    .btn-github {
        width: 100%;
        justify-content: center;
    }
}