/* ============================================
   ESCOLA FLORESCER - Painel Admin
   ============================================ */

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

body {
    font-family: 'Inter', sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    line-height: 1.6;
}

/* ===== LOGIN ===== */
.login-screen {
    min-height: 100vh;
    background: linear-gradient(135deg, #C8102E, #E63946);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo .logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #C8102E, #FF6B35);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.75rem;
    margin: 0 auto 1rem;
}

.login-logo .logo-img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    margin: 0 auto 1rem;
    display: block;
}

.sidebar-logo .logo-img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.login-logo h2 {
    color: #C8102E;
    font-family: 'Playfair Display', serif;
    margin-bottom: 0.25rem;
}

.login-logo p {
    color: #64748b;
    font-size: 0.9rem;
}

.login-box label {
    display: block;
    color: #1e293b;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.login-box input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1.25rem;
    transition: all 0.2s;
}

.login-box input:focus {
    outline: none;
    border-color: #E63946;
}

.login-box .btn-login {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, #C8102E, #E63946);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.login-box .btn-login:hover {
    transform: translateY(-2px);
}

.login-error {
    color: #dc2626;
    background: #fee2e2;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: center;
    display: none;
}

.login-error.show { display: block; }

.login-hint {
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
    margin-top: 1rem;
}

.login-hint code {
    background: #f1f5f9;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    color: #C8102E;
    font-weight: 600;
}

/* ===== ADMIN LAYOUT ===== */
.admin-app {
    display: flex;
    min-height: 100vh;
}

.admin-app.hidden { display: none; }

.sidebar {
    width: 260px;
    background: #0f172a;
    color: white;
    padding: 1.5rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s;
    z-index: 100;
}

.sidebar-logo {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-logo span { color: #FF6B35; }

.sidebar-logo .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #C8102E, #FF6B35);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-menu li button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-family: inherit;
    border-left: 3px solid transparent;
}

.sidebar-menu li button:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.sidebar-menu li button.active {
    background: rgba(255,107,53,0.15);
    color: #FF6B35;
    border-left-color: #FF6B35;
}

.sidebar-menu li button i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
}

.sidebar-footer a, .sidebar-footer button {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    transition: color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    width: 100%;
    text-align: left;
}

.sidebar-footer a:hover, .sidebar-footer button:hover { color: #FF6B35; }

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
}

.topbar {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.topbar h1 {
    font-family: 'Playfair Display', serif;
    color: #C8102E;
    font-size: 1.5rem;
}

/* Indicador de status de salvamento (auto-save) */
.save-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.875rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #f1f5f9;
    color: #64748b;
    transition: all 0.3s ease;
}

.save-status.editing {
    background: #fef3c7;
    color: #92400e;
}

.save-status.saved {
    background: #dcfce7;
    color: #166534;
    animation: saveBlink 0.4s ease;
}

.save-status.error {
    background: #fee2e2;
    color: #991b1b;
    animation: shakeStatus 0.4s ease;
}

@keyframes saveBlink {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes shakeStatus {
    0%, 100% { transform: translateX(0); }
    25%, 75% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
}

.topbar-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #C8102E, #E63946);
    color: white;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }

.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-outline {
    background: white;
    color: #C8102E;
    border: 2px solid #C8102E;
}

.btn-outline:hover { background: #C8102E; color: white; }

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.85rem; }

.menu-toggle-mobile {
    display: none;
    background: none;
    border: none;
    color: #C8102E;
    font-size: 1.5rem;
    cursor: pointer;
}

/* ===== TABS DE EDIÇÃO ===== */
.tab-content { display: none; }
.tab-content.active { display: block; }

.section-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.section-card h2 {
    color: #C8102E;
    font-family: 'Playfair Display', serif;
    margin-bottom: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1f5f9;
}

.section-card .section-desc {
    color: #64748b;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* ===== FORM FIELDS ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.form-grid.cols-1 { grid-template-columns: 1fr; }

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 0.375rem;
    font-size: 0.9rem;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: white;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: #E63946;
}

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

.field small {
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: block;
}

/* ===== ITEMS LIST (cards editáveis) ===== */
.items-list {
    display: grid;
    gap: 1rem;
}

.item-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.25rem;
    position: relative;
    transition: all 0.2s;
}

.item-card:hover { border-color: #FFA08C; }

.item-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.item-card-title {
    font-weight: 600;
    color: #C8102E;
    font-size: 1rem;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.icon-btn-danger { background: #fee2e2; color: #dc2626; }
.icon-btn-danger:hover { background: #dc2626; color: white; }

.icon-btn-up, .icon-btn-down { background: #FFE4D6; color: #C8102E; }
.icon-btn-up:hover, .icon-btn-down:hover { background: #C8102E; color: white; }

.btn-add {
    background: white;
    color: #C8102E;
    border: 2px dashed #FFA08C;
    padding: 1rem;
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-add:hover { background: #FFF0EC; border-color: #C8102E; }

/* ===== TOAST DE NOTIFICAÇÃO ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #16a34a;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 400px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error { background: #dc2626; }
.toast.warning { background: #f59e0b; }

/* ===== STATS / DASHBOARD ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-left: 4px solid #FF6B35;
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    background: #FFF0EC;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #C8102E;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #C8102E;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    color: #64748b;
    font-size: 0.9rem;
}

/* ===== HELP BOX ===== */
.help-box {
    background: #FFF0EC;
    border-left: 4px solid #E63946;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    color: #9F0E26;
    font-size: 0.9rem;
}

.help-box i { margin-right: 0.5rem; }

.help-box code {
    background: white;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    color: #C8102E;
    font-size: 0.85rem;
}

/* ===== PREVIEW DE IMAGENS ===== */
.image-preview {
    width: 100%;
    max-width: 200px;
    height: 120px;
    border-radius: 8px;
    background: #f1f5f9 url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2394a3b8"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>') center/40px no-repeat;
    background-size: cover;
    border: 2px solid #e2e8f0;
    margin-top: 0.5rem;
    object-fit: cover;
}

/* ===== CAMPO DE IMAGEM (URL + Upload) ===== */
.image-field {
    background: #fafafa;
    padding: 1rem;
    border-radius: 10px;
    border: 1px dashed #e2e8f0;
}

.image-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    flex-wrap: wrap;
}

.image-input-row input {
    flex: 1;
    min-width: 200px;
}

.btn-upload-imagem,
.btn-download-imagem {
    padding: 0.625rem 1rem;
    border-radius: 8px;
    border: 2px solid #C8102E;
    background: white;
    color: #C8102E;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.btn-upload-imagem:hover {
    background: #C8102E;
    color: white;
}

.btn-download-imagem {
    border-color: #16a34a;
    color: #16a34a;
}

.btn-download-imagem:hover {
    background: #16a34a;
    color: white;
}

.image-warning {
    display: none;
    background: #fef3c7;
    color: #92400e;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    border-left: 3px solid #f59e0b;
}

.image-warning.show {
    display: block;
}

.image-warning i {
    margin-right: 0.4rem;
}

.image-help {
    background: #FFF0EC;
    color: #C8102E;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    border-left: 3px solid #FF6B35;
}

.image-help i {
    margin-right: 0.4rem;
}

.image-help code {
    background: white;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
    color: #C8102E;
}

/* ===== MENSAGENS RECEBIDAS ===== */
.msg-card {
    background: #f8fafc;
    border-left: 4px solid #E63946;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.msg-name {
    font-weight: 600;
    color: #C8102E;
}

.msg-date {
    color: #64748b;
    font-size: 0.85rem;
}

.msg-contact {
    color: #64748b;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.msg-text {
    color: #1e293b;
    font-size: 0.95rem;
}

/* ===== RESPONSIVO ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .menu-toggle-mobile {
        display: block;
    }
}

@media (max-width: 640px) {
    .main-content { padding: 1rem; }
    .section-card { padding: 1.25rem; }
    .topbar { padding: 1rem; }
    .topbar h1 { font-size: 1.25rem; }
}
