/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    color: var(--primary-color, #4a6cf7);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color, #6c757d);
}

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

/* Utilitários */
.text-center {
    text-align: center;
}

.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mt-40 { margin-top: 40px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.mb-40 { margin-bottom: 40px; }
.p-20 { padding: 20px; }

.d-md-none { display: none; } /* Esconder em telas maiores */

/* Botões */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color, #4a6cf7);
    color: #fff;
    border-color: var(--primary-color, #4a6cf7);
}

.btn-primary:hover {
    background-color: #3a5ccc; /* Tom mais escuro */
    border-color: #3a5ccc;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(74, 108, 247, 0.3);
}

.btn-secondary {
    background-color: var(--secondary-color, #6c757d);
    color: #fff;
    border-color: var(--secondary-color, #6c757d);
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
    color: #fff;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
    color: #212529;
}

.btn-danger {
    background-color: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
    color: #fff;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.875em;
    border-radius: 5px;
}

/* Formulários */
.form-group {
    margin-bottom: 15px;
}

.form-control {
    display: block;
    width: 100%;
    padding: 10px 15px;
    font-size: 1em;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 8px;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: var(--primary-color, #80bdff);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(74, 108, 247, 0.25);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

label {
    display: inline-block;
    margin-bottom: .5rem;
    font-weight: 500;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -10px;
    margin-left: -10px;
}

.form-col {
    flex-basis: 0;
    flex-grow: 1;
    max-width: 100%;
    padding-right: 10px;
    padding-left: 10px;
}

/* Alertas */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Header (Frontend) */
.header {
    background-color: #fff;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    max-height: 40px;
    margin-right: 10px;
}

.logo h1 {
    font-size: 1.6em;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.main-nav a {
    margin-left: 20px;
    font-weight: 500;
    color: #555;
}

.main-nav a.active, .main-nav a:hover {
    color: var(--primary-color, #4a6cf7);
}

/* Main Content (Frontend) */
.main-container {
    padding-top: 30px;
    padding-bottom: 30px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
    padding-right: 15px;
    padding-left: 15px;
}

.col-md-9 {
    flex: 0 0 75%;
    max-width: 75%;
    padding-right: 15px;
    padding-left: 15px;
}

.section-title {
    font-size: 2em;
    font-weight: 600;
    color: #333;
    margin-bottom: 30px;
}

/* Menu de Categorias (Frontend) */
.category-menu {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
}

.category-menu h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.category-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-menu li {
    margin-bottom: 10px;
}

.category-menu a {
    text-decoration: none;
    color: var(--secondary-color, #6c757d);
    font-weight: 500;
    transition: color 0.3s ease, padding-left 0.3s ease;
    display: block;
    padding: 5px 0;
}

.category-menu a:hover {
    color: var(--primary-color, #4a6cf7);
    padding-left: 5px;
}

.category-menu a.active {
    color: var(--primary-color, #4a6cf7);
    font-weight: 700;
    padding-left: 5px;
}

/* Formulário de Download por Código (Frontend) */
.download-form-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
}

.download-form-container h3 {
     margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Seção de Categoria (Frontend) */
.category-section {
    margin-bottom: 40px;
    padding-bottom: 20px;
    /* border-bottom: 1px solid #eee; */ /* Remover borda se preferir */
}

.category-title {
    font-size: 1.8em;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--primary-color, #4a6cf7);
    border-left: 5px solid var(--primary-color, #4a6cf7);
    padding-left: 15px;
}

/* Grid de Aplicativos (Frontend) */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.app-card {
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.app-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.app-image {
    width: 100%;
    height: 200px; /* Altura fixa para a imagem */
    object-fit: cover; /* Cobre a área sem distorcer */
    border-bottom: 1px solid #eee;
}

.app-details {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.app-title {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.app-description {
    font-size: 0.95em;
    color: #666;
    margin-bottom: 15px;
    flex-grow: 1; /* Ocupa espaço disponível */
    /* Limitar altura e adicionar reticências (opcional) */
    /* max-height: 60px; 
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3; 
    -webkit-box-orient: vertical; */
}

.app-meta {
    font-size: 0.85em;
    color: #888;
    margin-bottom: 10px;
}

.app-meta span {
    margin-right: 15px;
}

.app-meta i {
    margin-right: 5px;
    color: var(--secondary-color, #6c757d);
}

.app-code {
    font-size: 0.8em;
    color: #aaa;
    margin-bottom: 15px;
    font-family: monospace;
    background-color: #f5f5f5;
    padding: 3px 6px;
    border-radius: 4px;
    display: inline-block;
}

.download-btn {
    margin-top: auto; /* Empurra o botão para baixo */
}

.download-btn i {
    margin-right: 8px;
}

/* Footer (Frontend) */
.footer {
    background-color: #e9ecef;
    padding: 20px 0;
    margin-top: 40px;
    color: #6c757d;
    font-size: 0.9em;
}

/* --- Estilos do Painel Admin --- */

.admin-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (Admin) */
.sidebar {
    width: 250px;
    background-color: #2c3e50; /* Cor escura para sidebar */
    color: #ecf0f1;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.sidebar-logo {
    text-align: center;
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-logo img {
    max-width: 60px;
    margin: 0 auto 10px auto;
}

.sidebar-logo h2 {
    font-size: 1.4em;
    font-weight: 600;
    margin: 0;
    color: #fff;
}

.sidebar-menu {
    flex-grow: 1;
    margin-top: 20px;
}

.sidebar-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li a {
    display: flex; /* Alterado para flex */
    align-items: center; /* Alinha ícone e texto */
    padding: 15px 25px;
    color: #bdc3c7;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease, padding-left 0.3s ease;
    font-size: 1.05em;
}

.sidebar-menu li a i {
    margin-right: 15px; /* Espaço entre ícone e texto */
    width: 20px; /* Largura fixa para ícones */
    text-align: center;
}

.sidebar-menu li a:hover {
    background-color: #34495e;
    color: #fff;
    padding-left: 30px;
}

.sidebar-menu li a.active {
    background-color: var(--primary-color, #4a6cf7);
    color: #fff;
    font-weight: 600;
    border-left: 4px solid #ecf0f1;
    padding-left: 21px; /* Ajuste por causa da borda */
}

/* Main Content (Admin) */
.main-content {
    flex-grow: 1;
    padding: 30px;
    background-color: #f4f7fc;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.page-title {
    font-size: 1.8em;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* Tabelas (Admin) */
.table-container {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    overflow-x: auto; /* Para tabelas responsivas */
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
    text-transform: uppercase;
}

table td {
    color: #444;
}

table tbody tr:hover {
    background-color: #f1f5f9;
}

table td .btn {
    margin-right: 5px;
}

/* Formulários (Admin) */
.form-container {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
}

#image-preview {
    max-width: 150px;
    max-height: 150px;
    margin-top: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 5px;
    display: none; /* Mostrado via JS */
}

/* Página de Login (Admin) - Estilos já definidos em login.php, mas podem ser centralizados aqui */
/* body.login-page { ... } */
/* .login-wrapper { ... } */
/* etc... */

/* Responsividade */
@media (max-width: 992px) {
    .col-md-3,
    .col-md-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .col-md-3 {
        margin-bottom: 30px;
    }
    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 0; /* Esconder sidebar por padrão */
        padding: 0;
        overflow: hidden;
        position: fixed; /* Ou absolute */
        left: -250px; /* Começa fora da tela */
        height: 100%;
        z-index: 1010;
        background-color: #2c3e50;
        transition: left 0.3s ease;
    }
    .sidebar.open {
        width: 250px;
        left: 0;
        padding: 20px 0;
    }
    .main-content {
        padding: 20px;
    }
    .page-header {
        margin-bottom: 20px;
    }
    .page-title {
        font-size: 1.5em;
    }
    .d-md-none {
        display: inline-block; /* Mostrar botão de menu */
    }
    .header-container {
        flex-wrap: wrap;
    }
    .main-nav {
        display: none; /* Simplificar header mobile */
    }
    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    .app-image {
        height: 150px;
    }
    .login-wrapper {
        padding: 30px 25px;
    }
}

@media (max-width: 576px) {
    .app-grid {
        grid-template-columns: 1fr; /* Uma coluna */
    }
    .form-row {
        margin-right: 0;
        margin-left: 0;
    }
    .form-col {
        flex-basis: 100%;
        max-width: 100%;
        padding-right: 0;
        padding-left: 0;
    }
    .btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .page-header .btn {
        margin-top: 10px;
    }
}

