/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #ffffff;
    color: #1a1a2e;
    line-height: 1.6;
}

/* Admin Container */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    gap: 0.75rem;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: #4a90e2;
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-left-color: #4a90e2;
}

.nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-item span {
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    background-color: #f8f9fa;
    min-height: 100vh;
}

/* Header */
.admin-header {
    background: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left h1 {
    font-size: 2rem;
    font-weight: 600;
    color: #1a1a2e;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#admin-name {
    font-weight: 500;
    color: #1a1a2e;
}

.btn-logout {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.btn-logout:hover {
    background: #c82333;
}

/* Content Wrapper */
.content-wrapper {
    padding: 2rem;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.section-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1a1a2e;
}

/* Buttons */
.btn-primary {
    background: #1a1a2e;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background: #16213e;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.btn-danger:hover {
    background: #c82333;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
}

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.metric-content h3 {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.metric-content p {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.25rem;
}

.metric-change {
    font-size: 0.8rem;
    font-weight: 500;
}

.metric-change.positive {
    color: #28a745;
}

.metric-change.negative {
    color: #dc3545;
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.chart-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 1rem;
}

/* Pricing */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.pricing-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pricing-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 1.5rem;
}

.price-input-group {
    margin-bottom: 1rem;
}

.price-input-group label {
    display: block;
    font-weight: 500;
    color: #1a1a2e;
    margin-bottom: 0.5rem;
}

.price-input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.price-input-group input:focus {
    outline: none;
    border-color: #1a1a2e;
}

.credit-packages {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.package-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.package-item label {
    font-weight: 500;
    color: #1a1a2e;
    flex: 1;
}

.package-item input {
    width: 120px;
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.package-item input:focus {
    outline: none;
    border-color: #1a1a2e;
}

.price-actions {
    display: flex;
    gap: 0.5rem;
}

/* Challenges */
.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.challenge-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.challenge-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1a1a2e;
}

.challenge-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #6c757d;
    color: white;
}

.challenge-status.active {
    background: #28a745;
}

.challenge-content p {
    color: #6c757d;
    margin-bottom: 1rem;
}

.challenge-config {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.config-item label {
    font-weight: 500;
    color: #1a1a2e;
    flex: 1;
}

.config-item input {
    width: 100px;
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.config-item input:focus {
    outline: none;
    border-color: #1a1a2e;
}

.challenge-actions {
    display: flex;
    gap: 0.5rem;
}

/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.analytics-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.analytics-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 1rem;
}

.date-filter select {
    padding: 0.5rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

/* Users */
.search-box {
    position: relative;
    width: 300px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #1a1a2e;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.users-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th {
    background: #f8f9fa;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #1a1a2e;
    border-bottom: 2px solid #e9ecef;
}

.users-table td {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    color: #1a1a2e;
}

.users-table tr:hover {
    background: #f8f9fa;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.settings-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.settings-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 1.5rem;
}

.setting-item {
    margin-bottom: 1rem;
}

.setting-item label {
    display: block;
    font-weight: 500;
    color: #1a1a2e;
    margin-bottom: 0.5rem;
}

.setting-item input[type="text"],
.setting-item input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.setting-item input:focus {
    outline: none;
    border-color: #1a1a2e;
}

.setting-item input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1a1a2e;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.modal-close:hover {
    background: #f8f9fa;
}

.modal-body {
    padding: 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .pricing-grid {
        grid-template-columns: 1fr;
    }
    
    .challenges-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .challenge-item {
        border-radius: 6px;
    }

    .challenge-header {
        padding: 0.5rem;
        min-height: 50px;
    }

    .challenge-controls {
        padding: 0.5rem;
    }

    .challenge-controls .form-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .challenge-actions {
        flex-direction: column;
        gap: 0.3rem;
    }

    .challenge-actions button {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .search-box {
        width: 100%;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1a1a2e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.message {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Challenges Specific Styles - Versão Compacta */
.challenges-container {
    position: relative;
}

.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.challenge-item {
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.challenge-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.challenge-header {
    padding: 0.75rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e1e1e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
}

.challenge-header > div:first-child {
    display: flex;
    align-items: flex-start;
    flex: 1;
    gap: 0.5rem;
}

.challenge-header input[type="text"] {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    background: white;
}

.challenge-header textarea {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    background: white;
    resize: vertical;
    min-height: 35px;
}

.challenge-info {
    flex: 1;
}

.challenge-status {
    padding: 0.2rem 0.6rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: #dc3545;
    color: white;
    flex-shrink: 0;
}

.challenge-status.active {
    background: #28a745;
}

.challenge-controls {
    padding: 0.75rem;
}

.challenge-controls .form-group {
    margin-bottom: 0.75rem;
}

.challenge-controls .form-group:last-of-type {
    margin-bottom: 1rem;
}

.challenge-controls .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.challenge-controls label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
    color: #495057;
    font-size: 0.8rem;
}

.challenge-controls input,
.challenge-controls textarea {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: border-color 0.3s ease;
}

.challenge-controls input:focus,
.challenge-controls textarea:focus {
    border-color: #1a1a2e;
    outline: none;
    box-shadow: 0 0 0 2px rgba(26, 26, 46, 0.1);
}

.challenge-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.challenge-actions button {
    flex: 1;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.challenge-actions .btn-primary {
    background: #1a1a2e;
    color: white;
}

.challenge-actions .btn-primary:hover {
    background: #2a2a4e;
}

.challenge-actions .btn-secondary {
    background: #6c757d;
    color: white;
}

.challenge-actions .btn-secondary:hover {
    background: #5a6268;
}

.challenge-actions .btn-danger {
    background: #dc3545;
    color: white;
}

.challenge-actions .btn-danger:hover {
    background: #c82333;
}

.loading-state, .empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.loading-state i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #1a1a2e;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #dee2e6;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #495057;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Challenge Form Modal */
.challenge-form {
    max-width: 500px;
}

.challenge-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.challenge-form .form-group {
    margin-bottom: 1rem;
}

.challenge-form select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: white;
}

.challenge-form textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    font-size: 0.9rem;
}

.challenge-controls textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.challenge-controls textarea:focus {
    border-color: #1a1a2e;
    outline: none;
    box-shadow: 0 0 0 2px rgba(26, 26, 46, 0.1);
}
