body {
    background: #f2f3f5;
    font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
    color: #1f2d3d;
}

#sidebar {
    position: sticky;
    top: 0;
    min-width: 250px;
    max-width: 250px;
    min-height: 100vh;
    height: 100vh;
    background: linear-gradient(180deg, #008000 0%, #0fbf7f 100%);
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.08);
    border-radius: 0 20px 20px 0;
    margin-top: -10px;
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

#sidebar .sidebar-toggle-btn {
    width: 90%;
    max-width: 180px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    white-space: nowrap;
}

#sidebar .sidebar-header {
    padding: 24px 20px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

#sidebar .sidebar-header h5 {
    font-weight: 700;
    letter-spacing: -0.2px;
    color: #ffffff;
}

#sidebar .sidebar-header small {
    font-weight: 500;
    color: #e6ffe6;
}

#sidebar .components {
    padding: 12px 0 24px;
    flex: 1;
}

#sidebar .components li a {
    color: #e6ffe6;
    padding: 14px 22px;
    display: flex;
    align-items: center;
    text-decoration: none;
    font-weight: 600;
    border-radius: 14px;
    margin: 6px 12px;
    transition: all 0.2s ease;
    background: rgba(255,255,255,0.06);
    gap: 10px;
}

#sidebar .components li a i {
    color: #e6ffe6;
    margin-right: 0;
}
.link-text {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

#sidebar .components li a:hover,
#sidebar .components li a.active {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}

#sidebar .sidebar-section {
    padding: 10px 22px;
    color: #c8f7c5;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 1px;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.12);
    margin-top: auto;
    padding-bottom: 12px;
}

#sidebar .sidebar-footer .sidebar-toggle-btn {
    width: calc(100% - 24px);
    margin: 0 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    color: #e6ffe6;
    font-weight: 600;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.1;
    cursor: pointer;
}

#sidebar .sidebar-footer .sidebar-toggle-btn:hover,
#sidebar .sidebar-footer .sidebar-toggle-btn:focus {
    background: rgba(255,255,255,0.14);
    color: #ffffff;
    outline: none;
}

#sidebar.collapsed {
    max-width: 72px;
    min-width: 72px;
    border-radius: 0 12px 12px 0;
}

#sidebar.collapsed .sidebar-header h5,
#sidebar.collapsed .sidebar-header small,
#sidebar.collapsed .link-text,
#sidebar.collapsed .sidebar-section {
    display: none;
}

#sidebar.collapsed .components li a {
    justify-content: center;
}

#sidebar.collapsed .components li a i {
    margin-right: 0;
}

#sidebar.collapsed .sidebar-footer {
    padding-left: 0;
    padding-right: 0;
    text-align: center;
}

#sidebar.collapsed .sidebar-toggle-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 14px;
    margin: 0 auto;
    gap: 0;
}

#sidebar.collapsed .sidebar-toggle-btn .toggle-text {
    display: none;
}

#sidebar.collapsed .sidebar-toggle-btn .toggle-icon {
    margin: 0;
}

#content {
    min-height: 100vh;
    background: #f2f3f5;
    flex: 1 1 auto;
    min-width: 0;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fb !important;
    border-bottom: none !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}

.navbar .navbar-brand {
    font-weight: 700;
}

.content-wrapper {
    max-width: 1280px;
    margin: 0 auto;
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #008000, #0fbf7f);
    padding: 20px;
}

.public-rifa-container {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #f2f3f5;
    padding: 30px 16px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.12);
}

.badge-status {
    font-size: 12px;
}

.ticket-grid {
    flex-wrap: wrap;
}

.ticket-option {
    min-width: 64px;
    min-height: 48px;
    text-align: center;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.ticket-option input {
    position: absolute;
    opacity: 0;
    inset: 0;
    cursor: pointer;
}

.ticket-option.active {
    background: #0fbf7f;
    color: #ffffff;
    border-color: #0fbf7f;
}

.ticket-option.ticket-paid {
    background: #0fbf7f;
    color: #ffffff;
    border-color: #0fbf7f;
    cursor: not-allowed;
    opacity: 0.9;
    font-weight: 600;
}

.ticket-option.ticket-reserved {
    background: #ffe9b3;
    color: #8a6d3b;
    border-color: #f0c36d;
    cursor: not-allowed;
    opacity: 0.9;
}

.ticket-option input:disabled {
    cursor: not-allowed;
}

.ticket-label {
    position: relative;
    z-index: 1;
}

.ticket-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    z-index: 2;
}

.ticket-badge.paid {
    background: #0f5132;
    color: #fff;
}

.ticket-badge.reserved {
    background: #c49a38;
    color: #212529;
}

.rifa-hero-wrapper {
    max-height: 240px;
    overflow: hidden;
    background: #f7f8fa;
}

.rifa-hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rifa-image-preview {
    max-height: 180px;
    width: 100%;
    object-fit: cover;
}

.pix-qr-wrapper {
    width: 220px;
    height: 220px;
    border: 1px solid #e5e8ed;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.pix-qr-image {
    width: 200px;
    height: 200px;
    object-fit: contain;
}

.font-weight-semibold {
    font-weight: 600;
}

.card {
    border: 1px solid #e5e8ed;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}

.stat-card {
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card h3 {
    font-weight: 700;
}

.section-card {
    border-radius: 14px;
    background: #ffffff;
}

.table thead th {
    border-top: none;
    background: #f9fafb;
    font-weight: 600;
}

.welcome-banner {
    background: #d7f4e3;
    color: #0f5132;
    border: 1px solid #b5e7c9;
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}

.table tbody tr:hover {
    background: #f9fafb;
}

.public-rifa-container .card {
    border: 2px solid #39ff14;
    animation: pulseBorder 2s ease-in-out infinite, glowShadow 3s ease-in-out infinite;
}

@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(57, 255, 20, 0.45); }
    50% { box-shadow: 0 0 0 8px rgba(57, 255, 20, 0); }
    100% { box-shadow: 0 0 0 0 rgba(57, 255, 20, 0); }
}

@keyframes glowShadow {
    0% { box-shadow: 0 0 14px rgba(57, 255, 20, 0.25); }
    50% { box-shadow: 0 0 22px rgba(57, 255, 20, 0.45); }
    100% { box-shadow: 0 0 14px rgba(57, 255, 20, 0.25); }
}

@media (max-width: 992px) {
    #sidebar {
        position: fixed;
        min-height: 100vh;
        height: 100vh;
        width: 100%;
        max-width: 100%;
        box-shadow: none;
        border-radius: 0 0 12px 12px;
        margin-top: 0;
        z-index: 20;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        padding-bottom: 16px;
    }
    .navbar {
        position: static;
        box-shadow: none;
    }
    .content-wrapper {
        padding: 0 8px;
        max-width: 100%;
    }
    .public-rifa-container {
        padding: 16px 8px;
    }
    #sidebar .sidebar-toggle-btn {
        width: 92%;
        max-width: none;
    }
}

/* Responsividade aprimorada */
@media (max-width: 992px) {
    body {
        overflow-x: hidden;
    }
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        max-width: 82%;
        height: 100vh;
        min-height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        border-radius: 0 12px 12px 0;
        z-index: 1050;
        box-shadow: 0 10px 28px rgba(0,0,0,0.16);
        padding-bottom: 18px;
    }
    #sidebar.open {
        transform: translateX(0);
    }
    #sidebar .components {
        padding: 12px 12px 16px;
    }
    #sidebar .sidebar-toggle-btn {
        width: 100%;
        max-width: 100%;
    }
    #content {
        width: 100%;
    }
    .navbar {
        position: sticky;
        top: 0;
        box-shadow: 0 4px 18px rgba(0,0,0,0.06);
    }
    .navbar .mobile-sidebar-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 8px;
    }
    .content-wrapper {
        padding: 0 10px 18px;
        max-width: 100%;
    }
    .stat-card {
        margin-bottom: 12px;
    }
    .ticket-option {
        min-width: 56px;
        min-height: 44px;
        margin: 4px;
        font-size: 14px;
    }
    .welcome-banner {
        padding: 12px 14px;
    }
    .public-rifa-container {
        padding: 18px 10px;
    }
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.35);
        z-index: 1040;
    }
    .sidebar-backdrop.show {
        display: block;
    }
}

@media (max-width: 768px) {
    .card.section-card .d-flex {
        flex-direction: column;
        align-items: flex-start;
    }
    .section-card .btn {
        width: 100%;
        margin-top: 8px;
    }
    .ticket-option {
        min-width: 52px;
        min-height: 42px;
        font-size: 13px;
    }
    .ticket-badge {
        top: 2px;
        right: 4px;
    }
    .navbar .navbar-brand {
        font-size: 18px;
    }
}

@media (max-width: 576px) {
    #sidebar .components {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    #sidebar .components li a {
        padding: 12px 10px;
        font-size: 14px;
    }
    .auth-container {
        padding: 12px;
    }
    .ticket-option {
        min-width: 48px;
        min-height: 40px;
    }
}
