/* ==========================================================================
   Repositório de Sistemas - IFCE Campus Tianguá
   Design Minimalista, Mobile-First e Ultra Clean
   ========================================================================== */

:root {
    --ifce-green: #155e21;
    --ifce-green-hover: #0e4417;
    --ifce-green-subtle: #f0fdf4;
    --ifce-green-border: #bbf7d0;

    --pesquisa-color: #4f46e5;
    --pesquisa-subtle: #eef2ff;
    --pesquisa-border: #c7d2fe;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --touch-min: 44px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    overflow-x: hidden;
    width: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Topo Compacto e Limpo (Estilo App Bar)
   ========================================================================== */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: inherit;
}

.brand-logo {
    height: 32px;
    width: auto;
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ifce-green);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-login-btn {
    min-height: 36px;
    padding: 0 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    transition: all 0.15s ease;
}

.header-login-btn:hover {
    color: var(--ifce-green);
    border-color: var(--ifce-green);
    background: var(--ifce-green-subtle);
}

/* ==========================================================================
   Contêiner Central
   ========================================================================== */
.main-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
    flex: 1;
}

/* ==========================================================================
   Barra de Busca e Segmentos (Clean & Compact)
   ========================================================================== */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 0.85rem;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-light);
    pointer-events: none;
}

.search-field {
    width: 100%;
    height: 46px;
    padding: 0 2.5rem 0 2.75rem;
    font-size: 16px;
    background: #ffffff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-main);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: all 0.15s ease;
}

.search-field:focus {
    outline: none;
    border-color: var(--ifce-green);
    box-shadow: 0 0 0 3px rgba(21, 94, 33, 0.1);
}

.search-clear {
    position: absolute;
    right: 0.6rem;
    width: 32px;
    height: 32px;
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    border-radius: var(--radius-full);
}

.search-clear.visible {
    display: flex;
}

/* Chips de Funcionalidade (Quebram linha naturalmente, zero scroll lateral) */
.func-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1.25rem;
    width: 100%;
    max-width: 100%;
}

.func-chip {
    min-height: 38px;
    padding: 0 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-muted);
    font-size: 0.825rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.func-chip:hover {
    border-color: var(--border-hover);
    color: var(--text-main);
}

.func-chip.active {
    background: var(--ifce-green);
    border-color: var(--ifce-green);
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(21, 94, 33, 0.2);
}

.func-chip-count {
    font-size: 0.72rem;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-muted);
}

.func-chip.active .func-chip-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}
    color: var(--text-light);
    padding: 1px 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-full);
}

.segment-btn.active .segment-count {
    background: var(--ifce-green-subtle);
    color: var(--ifce-green);
}

/* ==========================================================================
   Lista de Sistemas (Visual Nativo de App — Clean & Leve)
   ========================================================================== */
.systems-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

@media (min-width: 640px) {
    .systems-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* Item de Sistema */
.app-item {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
    position: relative;
    cursor: pointer;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.app-item:hover {
    border-color: var(--border-hover);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
}

.app-item:active {
    transform: scale(0.99);
}

/* Ícone */
.app-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}

.app-icon.ti {
    background-color: var(--ifce-green);
}

.app-icon.pesquisa {
    background-color: var(--pesquisa-color);
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

/* Informações */
.app-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.app-header-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.app-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.25;
}

.app-tag {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.app-tag.ti {
    background: var(--ifce-green-subtle);
    color: var(--ifce-green);
    border: 1px solid var(--ifce-green-border);
}

.app-tag.pesquisa {
    background: var(--pesquisa-subtle);
    color: var(--pesquisa-color);
    border: 1px solid var(--pesquisa-border);
}

.app-hint {
    font-size: 0.825rem;
    color: var(--text-muted);
    line-height: 1.35;
    margin-top: 0.15rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* Ações do item */
.app-item-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.app-info-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-light);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.15s ease;
}

.app-info-btn:hover {
    color: var(--ifce-green);
    background: var(--bg-page);
}

.app-arrow {
    color: var(--text-light);
    display: flex;
    align-items: center;
}

/* ==========================================================================
   Estado Vazio
   ========================================================================== */
.empty-box {
    grid-column: 1 / -1;
    background: #ffffff;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-box svg {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.empty-box h3 {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.empty-box p {
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.btn-clean {
    min-height: 36px;
    padding: 0 1rem;
    border: 1px solid var(--ifce-green);
    background: #ffffff;
    color: var(--ifce-green);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    cursor: pointer;
}

/* ==========================================================================
   Modal / Bottom Sheet (Detalhes do Sistema)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.open {
    display: flex;
}

.modal-sheet {
    background: #ffffff;
    width: 100%;
    max-width: 500px;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: sheetUp 0.2s ease-out;
}

@keyframes sheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@media (min-width: 640px) {
    .modal-overlay {
        align-items: center;
        padding: 1.5rem;
    }
    .modal-sheet {
        border-radius: var(--radius-lg);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.modal-head-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
}

.modal-content {
    padding: 1.25rem;
    overflow-y: auto;
}

.modal-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 1.25rem;
}

.modal-details-card {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.modal-detail-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.modal-detail-label {
    color: var(--text-light);
    font-weight: 500;
}

.modal-detail-val {
    color: var(--text-main);
    font-weight: 600;
    text-align: right;
}

.modal-foot {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
}

.btn-modal-open {
    flex: 1;
    min-height: 44px;
    background: var(--ifce-green);
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-modal-open:hover {
    background: var(--ifce-green-hover);
}

/* ==========================================================================
   Rodapé Simples
   ========================================================================== */
.site-footer {
    border-top: 1px solid var(--border);
    background: #ffffff;
    padding: 1.25rem 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}
