/* ==========================================================================
   HOMEPAGE.CSS - Tela de Seleção e Gerenciamento de Projetos
   ========================================================================== */

#homepage {
    display: none;
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 99998;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

body.show-homepage {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAACXBIWXMAAAPoAAAD6AG1e1JrAAAAIUlEQVR4nGOQUtX5r23pjBMzUEcBPsyArgPdRCooIOQGAAigZFnRRKyWAAAAAElFTkSuQmCC");
    -ms-interpolation-mode: nearest-neighbor;
    background-repeat: repeat;
    background-blend-mode: color-burn;
    background-color: rgba(34,40,59,0.4);
    background-position-x: 50%;
    background-position-y: center;
    background-size: 6rem;
    image-rendering: optimizeSpeed;
    image-rendering: -o-crisp-edges;
    image-rendering: pixelated;
    image-rendering: optimize-contrast;
}

body.show-homepage #homepage {
    display: flex;
}

/* Cabeçalho da homepage */
.hp-header {
    text-align: center;
    margin-bottom: 40px;
}

.hp-header h1 {
    font-size: 28px;
    color: #2c3e50;
    margin-bottom: 6px;
}

.hp-header p {
    font-size: 14px;
    color: #7f8c8d;
}

/* Grade de projetos */
.hp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    width: 100%;
    max-width: 900px;
}

/* Card de projeto existente */
.hp-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    border: 2px solid transparent;
}

.hp-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    border-color: #3498db;
}

.hp-card-icon {
    font-size: 28px;
    margin-bottom: 10px;
}

.hp-card-name {
    font-size: 15px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hp-card-date {
    font-size: 11px;
    color: #95a5a6;
}

/* Ações do card (renomear / apagar) */
.hp-card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.hp-card:hover .hp-card-actions {
    opacity: 1;
}

.hp-card-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: #7f8c8d;
    transition: background 0.15s, color 0.15s;
}

.hp-card-actions button:hover {
    background: #f0f0f0;
    color: #2c3e50;
}

.hp-card-actions .hp-btn-delete:hover {
    background: #fdf2f2;
    color: #e74c3c;
}

/* Card de novo projeto */
.hp-card-new {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 2px dashed #bdc3c7;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    color: #95a5a6;
    font-size: 14px;
    gap: 8px;
}

.hp-card-new:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    border-color: #3498db;
    color: #3498db;
}

.hp-card-new i {
    font-size: 24px;
}

/* Mensagem quando não há projetos */
.hp-empty {
    text-align: center;
    color: #95a5a6;
    font-size: 14px;
    grid-column: 1 / -1;
    padding: 20px 0;
}

/* Limite de projetos atingido */
.hp-limit-msg {
    text-align: center;
    font-size: 12px;
    color: #e67e22;
    margin-top: 16px;
}

/* Modal de renomear */
#hp-rename-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

#hp-rename-modal.open {
    display: flex;
}

.hp-modal-box {
    background: white;
    border-radius: 12px;
    padding: 28px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.hp-modal-box h3 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 14px;
}

.hp-modal-box input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
    box-sizing: border-box;
    color: #2c3e50;
}

.hp-modal-box input:focus {
    outline: none;
    border-color: #3498db;
}

.hp-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.hp-modal-actions button {
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

.hp-btn-cancel {
    background: white;
    border: 1px solid #ddd;
    color: #7f8c8d;
}

.hp-btn-cancel:hover {
    background: #f5f5f5;
}

.hp-btn-confirm {
    background: #3498db;
    border: none;
    color: white;
}

.hp-btn-confirm:hover {
    background: #2980b9;
}

/* Modal de confirmação de exclusão */
#hp-delete-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

#hp-delete-modal.open {
    display: flex;
}

.hp-btn-danger {
    background: #e74c3c;
    border: none;
    color: white;
}

.hp-btn-danger:hover {
    background: #c0392b;
}

/* Botão de exportar no card */
.hp-card-actions .hp-btn-export:hover {
    background: #eaf3de;
    color: #27ae60;
}

/* Botão de importar global */
.hp-import-area {
    margin-top: 20px;
    width: 100%;
    max-width: 900px;
    display: flex;
    justify-content: flex-end;
}

.hp-btn-import {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.7);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hp-btn-import:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: rgba(255,255,255,0.6);
}

.hp-card-name,
.hp-card-icon,
.hp-card-date {
    color: initial;
}

.hp-card-name {
    color: #2c3e50 !important;
}

.hp-card-date {
    color: #95a5a6;
}

.hp-card * {
    color: #2c3e50;
}

.hp-card .hp-card-date {
    color: #95a5a6;
}