/* Estilo principal do Sistema de Feira de Robótica */
/* Sistema simples em PHP, HTML, CSS e JS - Sem dependências */

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

/* Logo responsiva - dentro do container */
.logo-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-container img {
    max-width: 150px;
    height: auto;
    max-height: 50px;
    object-fit: contain;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .logo-container {
        justify-content: center;
        margin-bottom: 15px;
    }
    
    .logo-container img {
        max-width: 120px;
        max-height: 40px;
    }
}

@media (max-width: 480px) {
    .logo-container img {
        max-width: 100px;
        max-height: 35px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.container-wide {
    max-width: 1200px;
    overflow-x: hidden; /* Previne scroll horizontal */
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

h2 {
    margin-bottom: 20px;
    font-size: 1.8em;
    text-align: center;
}

h3 {
    margin-bottom: 15px;
    font-size: 1.4em;
}

p {
    margin-bottom: 15px;
    line-height: 1.6;
}

/* Ícones grandes */
.icon-large {
    font-size: 4em;
    text-align: center;
    margin-bottom: 20px;
}

.icon-success {
    font-size: 5em;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
    text-align: center;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

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

input[type="text"], input[type="tel"], input[type="url"] {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1.2em;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    transition: all 0.3s ease;
}

input[type="text"]:focus, input[type="tel"]:focus, input[type="url"]:focus {
    outline: none;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

input[type="tel"]::placeholder {
    color: #666;
}

/* Botões */
.btn {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    cursor: pointer;
    transition: transform 0.3s;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.btn-large {
    padding: 20px 40px;
    font-size: 1.3em;
}

.btn-success {
    background: linear-gradient(45deg, #4CAF50, #45a049);
}

.btn-info {
    background: linear-gradient(45deg, #2196F3, #1976D2);
}

.btn-secondary {
    background: linear-gradient(45deg, #6c757d, #5a6268);
}

/* Cards de informações */
.info-card {
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    overflow: hidden;
    word-wrap: break-word;
    min-width: 0; /* Permite que o flex/grid item encolha */
}

.sala-info {
    background: rgba(255, 255, 255, 0.15);
    padding: 25px;
    border-radius: 15px;
    margin: 20px 0;
    text-align: center;
}

.sala-numero {
    font-size: 3em;
    font-weight: bold;
    color: #4CAF50;
    margin-bottom: 10px;
}

.sala-tema {
    font-size: 1.8em;
    margin-bottom: 10px;
    font-weight: 500;
}

.sala-turma {
    font-size: 1.2em;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 20px;
    display: inline-block;
}

/* Grid de salas */
.salas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.sala-card {
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    text-decoration: none;
    color: white;
    text-align: center;
}

.sala-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    text-decoration: none;
}

.sala-card.visitada {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
}

.sala-card h4 {
    margin-bottom: 10px;
    font-size: 1.2em;
}

.sala-card .tema {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 10px;
}

.sala-card .turma {
    font-size: 0.8em;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 15px;
    display: inline-block;
    margin-bottom: 10px;
}

.sala-card .status {
    font-size: 0.9em;
    font-weight: bold;
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: rgba(255, 255, 255, 0.15);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: #4CAF50;
    margin: 10px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.stat-label {
    font-size: 1em;
    opacity: 0.9;
}

/* Lista de ranking */
.ranking-list {
    list-style: none;
    padding: 0;
    max-height: 400px; /* Altura padrão, será sobrescrita no dashboard */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Estilo do scrollbar para ranking list */
.ranking-list::-webkit-scrollbar {
    width: 6px;
}

.ranking-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.ranking-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.ranking-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-nome {
    font-weight: 500;
    flex-grow: 1;
}

.ranking-count {
    background: rgba(76, 175, 80, 0.8);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    margin-left: 10px;
}

/* Atividade recente */
.atividade-list {
    max-height: 400px; /* Altura padrão, será sobrescrita no dashboard */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Estilo do scrollbar para webkit */
.atividade-list::-webkit-scrollbar {
    width: 6px;
}

.atividade-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.atividade-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.atividade-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.atividade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.atividade-item:last-child {
    border-bottom: none;
}

.atividade-info {
    flex-grow: 1;
}

.atividade-nome {
    font-weight: 500;
}

.atividade-sala {
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 2px;
}

.atividade-tempo {
    font-size: 0.8em;
    opacity: 0.7;
    text-align: right;
}

/* QR Codes */
.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.qr-card {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.qr-code {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.url-display {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    word-break: break-all;
    margin: 10px 0;
    border: 1px solid #ddd;
    color: #333;
}

/* Loading e spinners */
.loading {
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Progresso */
.progresso-container {
    margin: 20px 0;
    text-align: center;
}

.progresso-bar {
    background: rgba(255, 255, 255, 0.3);
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progresso-fill {
    height: 100%;
    background: linear-gradient(45deg, #4CAF50, #81C784);
    transition: width 0.5s ease;
}

/* Mensagens */
.message {
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

.message-success {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
}

.message-error {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.5);
}

.message-info {
    background: rgba(33, 150, 243, 0.2);
    border: 1px solid rgba(33, 150, 243, 0.5);
}

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 40px 0;
    align-items: start; /* Alinha cards no topo */
}

/* Cards do dashboard com altura padrão */
.dashboard-grid .info-card {
    height: 600px; /* Altura fixa para ambos os cards */
    display: flex;
    flex-direction: column;
}

.dashboard-grid .info-card h3 {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.dashboard-grid .ranking-list,
.dashboard-grid .atividade-list {
    flex-grow: 1;
    max-height: 520px; /* Altura ajustada para caber no card de 600px */
}

/* Responsividade */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .salas-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .qr-grid {
        grid-template-columns: 1fr;
    }
    
    /* Dashboard responsivo */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 30px 0;
    }
    
    /* Remover altura fixa no mobile */
    .dashboard-grid .info-card {
        height: auto;
    }
    
    .dashboard-grid .ranking-list,
    .dashboard-grid .atividade-list {
        max-height: 300px; /* Menor no mobile */
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8em;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 1em;
        margin: 5px;
    }
    
    input[type="text"], input[type="tel"], input[type="url"] {
        font-size: 1em;
        padding: 12px;
    }
    
    /* Dashboard mobile melhorado */
    .dashboard-grid {
        gap: 15px;
        margin: 20px 0;
    }
    
    .info-card {
        padding: 15px;
    }
    
    .info-card h3 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    
    /* Ranking list mobile */
    .ranking-item {
        padding: 8px 0;
        flex-wrap: wrap;
        align-items: flex-start;
    }
    
    .ranking-nome {
        font-size: 0.9em;
        max-width: calc(100% - 60px); /* Deixa espaço para o contador */
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    .ranking-count {
        margin-left: 0;
        margin-top: 5px;
        align-self: flex-start;
    }
    
    /* Atividade mobile */
    .atividade-item {
        padding: 8px 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .atividade-info {
        width: 100%;
    }
    
    .atividade-nome {
        font-size: 0.9em;
        font-weight: bold;
    }
    
    .atividade-sala {
        font-size: 0.8em;
        word-break: break-word;
    }
    
    .atividade-tempo {
        font-size: 0.8em;
        align-self: flex-end;
        margin-top: -20px;
    }
    
}

/* Impressão */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .container {
        background: white;
        box-shadow: none;
        border: none;
    }
    
    .btn {
        display: none;
    }
}

/* Página de Certificado */
.certificado-container {
    background: linear-gradient(135deg, #ff7f44 0%, #ff6935 80%, #764ba2 100%);
    height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
    font-family: 'Arial', sans-serif;
    color: white;
    position: relative;
    overflow: hidden;
}

/* Onda azul com degradê - mais larga com três curvas */
.certificado-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 65%;
    height: 25%;
    background: linear-gradient(135deg, #b61b28 0%, #2e7bc9 30%, #be2b9a 80%);
    border-radius: 60% 40% 80% 0 / 50% 70% 60% 0;
    z-index: 1;
}

.certificado-content {
    max-width: 45%;
    width: 45%;
    text-align: left;
    position: absolute;
    top: 15%;
    left: 5%;
    z-index: 4;
    padding: 0;
}

.certificado-titulo {
    font-size: 4em;
    font-weight: 900;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-style: italic;
    transform: skewX(-5deg);
}

.certificado-texto1 {
    font-size: 1.4em;
    line-height: 1.3;
    margin-bottom: 15px;
    font-weight: 300;
}

.certificado-texto2 {
    font-size: 1.4em;
    line-height: 1.3;
    margin-bottom: 25px;
    font-weight: 300;
}

.certificado-texto3 {
    font-size: 1.4em;
    line-height: 1.3;
    margin-bottom: 20px;
    font-weight: 300;
}

.certificado-texto4 {
    font-size: 1.2em;
    line-height: 1.3;
    margin-bottom: 0;
    font-weight: 300;
    font-style: italic;
    opacity: 0.9;
}

.destaque {
    font-weight: bold;
}

.instagram-link {
    color: white;
    font-weight: bold;
    text-decoration: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
}

.instagram-link:hover {
    border-bottom-color: white;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.certificado-ilustracao {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background-image: url('../img/MeninoSFcopy.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom center;
    z-index: 3;
}

.certificado-logo {
    position: absolute;
    bottom: 50px;
    right: 30px;
    width: 80px;
    height: auto;
    z-index: 4;
}

.certificado-logo img {
    width: 100%;
    height: auto;
    filter: brightness(1.2);
}

.certificado-botoes {
    position: absolute;
    top: 20px;
    left: 5%;
    z-index: 10;
    display: flex;
    gap: 15px;
    justify-content: flex-start;
}

/* Responsividade do certificado */
@media (max-width: 768px) {
    .certificado-container::after {
        width: 65%;
        height: 30%;
        border-radius: 55% 35% 70% 0 / 45% 60% 50% 0;
    }
    
    .certificado-content {
        max-width: 50%;
        width: 50%;
        top: 18%;
        left: 5%;
    }
    
    .certificado-titulo {
        font-size: 2.2em;
        margin-bottom: 15px;
    }
    
    .certificado-texto1,
    .certificado-texto2,
    .certificado-texto3 {
        font-size: 1.0em;
        margin-bottom: 12px;
        line-height: 1.2;
    }
    
    .certificado-texto4 {
        font-size: 0.9em;
        line-height: 1.2;
    }
    
    .certificado-ilustracao {
        width: 400px;
        height: 400px;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .certificado-logo {
        width: 60px;
        bottom: 35px;
        right: 20px;
    }
    
    .certificado-botoes {
        top: 15px;
        left: 5%;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .certificado-container::after {
        width: 70%;
        height: 18%;
        border-radius: 50% 30% 60% 0 / 40% 55% 45% 0;
    }
    
    .certificado-content {
        max-width: 60%;
        width: 60%;
        top: 25%;
        left: 5%;
    }
    
    .certificado-titulo {
        font-size: 1.8em;
        margin-bottom: 12px;
    }
    
    .certificado-texto1,
    .certificado-texto2,
    .certificado-texto3 {
        font-size: 0.85em;
        margin-bottom: 10px;
        line-height: 1.15;
    }
    
    .certificado-texto4 {
        font-size: 0.75em;
        line-height: 1.15;
    }
    
    .certificado-ilustracao {
        width: 300px;
        height: 300px;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .certificado-logo {
        width: 45px;
        bottom: 25px;
        right: 15px;
    }
    
    .certificado-botoes {
        top: 10px;
        left: 5%;
        gap: 5px;
        flex-direction: column;
    }
}

/* Animações extras */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}