/* ============================================
   POSTERA - Design System
   ============================================ */

:root {
    --postera-primary: #1a1a2e;
    --postera-secondary: #16213e;
    --postera-accent: #0f3460;
    --postera-highlight: #e94560;
    --postera-success: #00d26a;
    --postera-warning: #ffc107;
    --postera-danger: #dc3545;
    --postera-light: #f8f9fa;
    --postera-dark: #0a0a14;
    --postera-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --postera-card-bg: rgba(255, 255, 255, 0.95);
    --postera-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    --postera-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);
    --postera-border-radius: 16px;
    --postera-transition: all 0.3s ease;
}

html, body {
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--postera-gradient);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

h1:focus {
    outline: none;
}

/* ============================================
   Botões
   ============================================ */

.btn-postera-primary {
    background: linear-gradient(135deg, var(--postera-highlight) 0%, #c73e54 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 12px 32px;
    border-radius: 12px;
    transition: var(--postera-transition);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.btn-postera-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.5);
    background: linear-gradient(135deg, #f05575 0%, #e94560 100%);
    color: white;
}

.btn-postera-secondary {
    background: transparent;
    border: 2px solid var(--postera-accent);
    color: var(--postera-accent);
    font-weight: 600;
    padding: 10px 30px;
    border-radius: 12px;
    transition: var(--postera-transition);
}

.btn-postera-secondary:hover {
    background: var(--postera-accent);
    color: white;
    transform: translateY(-2px);
}

.btn-postera-success {
    background: linear-gradient(135deg, var(--postera-success) 0%, #00b359 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 12px 32px;
    border-radius: 12px;
    transition: var(--postera-transition);
    box-shadow: 0 4px 15px rgba(0, 210, 106, 0.4);
}

.btn-postera-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 210, 106, 0.5);
    color: white;
}

.postera-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 12px;
    transition: var(--postera-transition);
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
}

.postera-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.postera-btn-primary {
    background: linear-gradient(135deg, var(--postera-highlight) 0%, #c73e54 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.postera-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.5);
    background: linear-gradient(135deg, #f05575 0%, #e94560 100%);
}

.postera-btn-secondary {
    background: var(--postera-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(26, 26, 46, 0.3);
}

.postera-btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 26, 46, 0.4);
    background: var(--postera-secondary);
}

.postera-btn-outline {
    background: transparent;
    border: 2px solid var(--postera-accent);
    color: var(--postera-accent);
}

.postera-btn-outline:hover:not(:disabled) {
    background: var(--postera-accent);
    color: white;
    transform: translateY(-2px);
}

/* ============================================
   Cards
   ============================================ */

.postera-card {
    background: var(--postera-card-bg);
    border-radius: var(--postera-border-radius);
    box-shadow: var(--postera-shadow);
    padding: 40px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.postera-card-dark {
    background: rgba(26, 26, 46, 0.9);
    border-radius: var(--postera-border-radius);
    box-shadow: var(--postera-shadow-lg);
    padding: 40px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

/* ============================================
   Inputs
   ============================================ */

.postera-input {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--postera-dark);
    padding: 14px 20px;
    font-size: 1rem;
    transition: var(--postera-transition);
    width: 100%;
}

.postera-input:focus {
    outline: none;
    border-color: var(--postera-highlight);
    box-shadow: 0 0 0 4px rgba(233, 69, 96, 0.1);
    background: white;
}

.postera-input::placeholder {
    color: #999;
}

.postera-input-dark {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: white;
    padding: 14px 20px;
    font-size: 1rem;
    transition: var(--postera-transition);
    width: 100%;
}

.postera-input-dark:focus {
    outline: none;
    border-color: var(--postera-highlight);
    box-shadow: 0 0 0 4px rgba(233, 69, 96, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.postera-input-dark::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   Formulários
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    color: var(--postera-dark);
}

.form-label-light {
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   Layout - Login e páginas públicas
   ============================================ */

.postera-public-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--postera-gradient);
}

.postera-login-container {
    width: 100%;
    max-width: 480px;
}

/* ============================================
   Layout - Aplicação autenticada
   ============================================ */

.postera-app-layout {
    display: flex;
    min-height: 100vh;
}

.postera-sidebar {
    width: 280px;
    background: var(--postera-primary);
    color: white;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 900;
}

.postera-sidebar-logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 30px;
}

.postera-sidebar-logo img {
    max-width: 180px;
    height: auto;
}

.postera-sidebar-nav {
    flex: 1;
}

.postera-nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: var(--postera-transition);
    font-weight: 500;
}

.postera-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.postera-nav-item.active {
    background: var(--postera-highlight);
    color: white;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.postera-nav-item svg {
    margin-right: 12px;
    width: 20px;
    height: 20px;
}

.postera-main-content {
    flex: 1;
    background: #f0f2f5;
    padding: 30px;
    overflow-y: auto;
    margin-left: 280px;
}

.postera-page-header {
    margin-bottom: 30px;
}

.postera-page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--postera-primary);
    margin-bottom: 8px;
}

.postera-page-subtitle {
    color: #666;
    font-size: 1.1rem;
}

/* ============================================
   QR Code
   ============================================ */

.postera-qrcode-container {
    background: white;
    padding: 30px;
    border-radius: var(--postera-border-radius);
    box-shadow: var(--postera-shadow);
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.postera-qrcode-container img {
    max-width: 280px;
    height: auto;
    border-radius: 8px;
}

.postera-qrcode-instructions {
    margin-top: 20px;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ============================================
   Status e Badges
   ============================================ */

.postera-status {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.postera-status-success {
    background: rgba(0, 210, 106, 0.1);
    color: var(--postera-success);
}

.postera-status-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #d4a106;
}

.postera-status-danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--postera-danger);
}

.postera-status-info {
    background: rgba(15, 52, 96, 0.1);
    color: var(--postera-accent);
}

/* ============================================
   Alertas
   ============================================ */

.postera-alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.postera-alert-success {
    background: rgba(0, 210, 106, 0.1);
    border: 1px solid rgba(0, 210, 106, 0.2);
    color: #008a46;
}

.postera-alert-warning {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.2);
    color: #9a7b00;
}

.postera-alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
    color: #a71d2a;
}

.postera-alert-info {
    background: rgba(15, 52, 96, 0.1);
    border: 1px solid rgba(15, 52, 96, 0.2);
    color: var(--postera-accent);
}

.postera-alert svg {
    margin-right: 12px;
    flex-shrink: 0;
}

/* ============================================
   Dialogs / Popups
   ============================================ */

.pool-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 24px;
    z-index: 1000;
}

.pool-dialog {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.pool-dialog-lg { max-width: 550px; }

.pool-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    position: sticky;
    bottom: 0;
    background: white;
    padding-top: 12px;
}

/* ============================================
   Estatísticas
   ============================================ */

.postera-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.postera-stat-card {
    background: white;
    border-radius: var(--postera-border-radius);
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: var(--postera-transition);
}

.postera-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.postera-stat-label {
    color: #888;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.postera-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--postera-primary);
}

.postera-stat-trend {
    margin-top: 8px;
    font-size: 0.85rem;
}

.postera-stat-trend.positive {
    color: var(--postera-success);
}

.postera-stat-trend.negative {
    color: var(--postera-danger);
}

/* ============================================
   Tabelas
   ============================================ */

.postera-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--postera-border-radius);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.postera-table th {
    background: var(--postera-primary);
    color: white;
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.postera-table td {
    padding: 14px 20px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.postera-table tr:last-child td {
    border-bottom: none;
}

.postera-table tr:hover td {
    background: rgba(15, 52, 96, 0.02);
}

/* ============================================
   Loading
   ============================================ */

.postera-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.postera-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(233, 69, 96, 0.2);
    border-top-color: var(--postera-highlight);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.postera-spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.postera-loading-text {
    margin-top: 16px;
    color: #666;
    font-weight: 500;
}

/* ============================================
   Animações
   ============================================ */

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

.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   Responsividade
   ============================================ */

@media (max-width: 768px) {
    .postera-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: var(--postera-transition);
    }

    .postera-sidebar.open {
        left: 0;
    }

    .postera-main-content {
        padding: 20px;
        margin-left: 0;
    }

    .postera-page-title {
        font-size: 1.5rem;
    }

    .postera-card,
    .postera-card-dark {
        padding: 24px;
    }

    .postera-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Componentes de erro e validação
   ============================================ */

.valid.modified:not([type=checkbox]) {
    outline: none;
    border-color: var(--postera-success) !important;
}

.invalid {
    outline: none;
    border-color: var(--postera-danger) !important;
}

.validation-message {
    color: var(--postera-danger);
    font-size: 0.85rem;
    margin-top: 6px;
}

/* ============================================
   Blazor Error UI
   ============================================ */

#blazor-error-ui {
    color-scheme: light only;
    background: var(--postera-danger);
    bottom: 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 16px 24px;
    position: fixed;
    width: 100%;
    z-index: 9999;
    color: white;
    font-weight: 500;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

#blazor-error-ui .reload {
    color: white;
    text-decoration: underline;
}

.blazor-error-boundary {
    background: var(--postera-danger);
    padding: 20px 24px;
    color: white;
    border-radius: 12px;
}

.blazor-error-boundary::after {
    content: "Ocorreu um erro inesperado."
}

/* ============================================
   Loading Progress
   ============================================ */

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--postera-highlight);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: white;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Carregando...");
}

/* ============================================
   Utilidades
   ============================================ */

.text-muted {
    color: #888 !important;
}

.text-center {
    text-align: center !important;
}

.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }
.mt-5 { margin-top: 3rem !important; }

.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mb-4 { margin-bottom: 2rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

.w-100 { width: 100% !important; }
