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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Charts section */
.charts-section {
    padding: 30px;
    border-bottom: 1px solid #f1f3f4;
}

.charts-section h3 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-wrapper {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-wrapper h4 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
    font-size: 1.1em;
}

.chart-wrapper canvas {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

/* Daily tidbit */
.daily-tidbit {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid #007bff;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: help;
    transition: all 0.2s ease;
}

.daily-tidbit:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.daily-tidbit h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.1em;
}

.daily-tidbit p {
    margin: 0;
    color: #555;
    line-height: 1.5;
    font-style: italic;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 16px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.toast.error {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
}

.toast.loading {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

.main-content {
    padding: 25px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.app-title {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5em;
    font-weight: 600;
}

.user-menu {
    position: relative;
    display: inline-block;
}

.user-menu-button {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-menu-button:hover {
    background: #e9ecef;
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 10px;
    min-width: 200px;
    display: none;
    z-index: 100;
}

.user-menu.open .user-menu-dropdown {
    display: block;
}

.user-menu-item {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease;
    font-size: 14px;
}

.user-menu-item:hover {
    background: #f8f9fa;
}

.user-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
}

.user-button {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    background: #007bff;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.user-button:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,123,255,0.3);
}

.user-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.challenge-info {
    background: linear-gradient(135deg, #6f42c1 0%, #6610f2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(111, 66, 193, 0.3);
}

.challenge-days {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 5px;
}

.challenge-label {
    font-size: 1.1em;
    opacity: 0.9;
}

.users-list {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.users-list-header {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    text-align: center;
}

.users-list-header h3 {
    margin: 0;
    color: #495057;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #f1f3f4;
    transition: background 0.3s ease;
}

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

.user-item.current-user {
    background: #e8f4fd;
    border-left: 4px solid #007bff;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.user-details h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 16px;
}

.user-details p {
    margin: 2px 0 0 0;
    color: #6c757d;
    font-size: 14px;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.status-badge.done {
    background: #d4edda;
    color: #155724;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.status-badge.failed {
    background: #f8d7da;
    color: #721c24;
}

.failure-screen {
    max-width: 500px;
    margin: 0 auto;
    padding: 40px 30px;
    text-align: center;
    background: linear-gradient(135deg, #ff6b6b 0%, #dc3545 100%);
    border-radius: 15px;
    color: white;
    box-shadow: 0 10px 30px rgba(220, 53, 69, 0.3);
}

.failure-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.failure-title {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 15px;
}

.failure-message {
    font-size: 1.2em;
    margin-bottom: 30px;
    opacity: 0.9;
    line-height: 1.5;
}

.failure-stats {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 20px;
    margin: 30px 0;
}

.failure-stats h4 {
    margin: 0 0 15px 0;
    font-size: 1.3em;
}

.failure-stats p {
    margin: 5px 0;
    opacity: 0.9;
}

.restart-button {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid white;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.restart-button:hover {
    background: white;
    color: #dc3545;
}

.admin-button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin-top: 20px;
}

.admin-button:hover {
    background: #c82333;
    text-decoration: none;
    color: white;
}

.legend {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.success {
    background: #28a745;
}

.legend-dot.fail {
    background: #dc3545;
}

.token-setup {
    max-width: 600px;
    margin: 0 auto;
    padding: 30px;
    text-align: center;
}

.token-setup h2 {
    color: #495057;
    margin-bottom: 20px;
}

.token-setup p {
    color: #6c757d;
    margin-bottom: 30px;
    line-height: 1.6;
}

.token-input-group {
    margin-bottom: 20px;
}

.token-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.token-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.token-button {
    padding: 15px 30px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.token-button:hover {
    background: #0056b3;
}

.token-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.token-url {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    word-break: break-all;
}

.token-url a {
    color: #007bff;
    text-decoration: none;
}

.token-url a:hover {
    text-decoration: underline;
}

.steps {
    text-align: left;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.steps ol {
    margin: 0;
    padding-left: 20px;
}

.steps li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.username-setup {
    max-width: 500px;
    margin: 0 auto;
    padding: 30px;
    text-align: center;
}

.username-setup h2 {
    color: #495057;
    margin-bottom: 15px;
}

.username-setup p {
    color: #6c757d;
    margin-bottom: 25px;
}

.username-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.username-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.username-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.username-button {
    padding: 12px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
    white-space: nowrap;
}

.username-button:hover {
    background: #218838;
}


.user-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc3545;
    position: relative;
}

.user-indicator.done {
    background: #28a745;
}

.user-indicator.current-user {
    border: 2px solid #007bff;
    width: 12px;
    height: 12px;
}

.user-tooltip {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.user-indicator:hover .user-tooltip {
    opacity: 1;
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 10px;
    }

    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 2em;
    }

    .main-content {
        padding: 20px;
    }

    .challenge-days {
        font-size: 2em;
    }

    .user-item {
        padding: 12px 15px;
    }

    .user-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .user-controls {
        flex-direction: column;
        align-items: center;
    }

    .user-button {
        width: 100%;
        max-width: 300px;
    }

    .legend {
        flex-direction: column;
        gap: 15px;
    }

    .token-setup {
        padding: 20px;
    }

    .token-setup h2 {
        font-size: 1.5em;
    }

    .steps {
        margin: 15px 0;
        padding: 15px;
    }

    .username-setup {
        padding: 20px;
    }

    .username-input-group {
        flex-direction: column;
        gap: 15px;
    }

    .username-button {
        width: 100%;
    }

    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .toast {
        max-width: none;
    }

    .app-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .user-menu-dropdown {
        right: auto;
        left: 0;
    }

    .failure-screen {
        padding: 30px 20px;
    }

    .failure-title {
        font-size: 2em;
    }

    .failure-icon {
        font-size: 3em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .challenge-info {
        padding: 15px;
    }

    .challenge-days {
        font-size: 1.8em;
    }

    .user-item {
        padding: 10px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .user-info {
        gap: 10px;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .user-details h4 {
        font-size: 14px;
    }

    .user-details p {
        font-size: 12px;
    }

    .failure-screen {
        padding: 20px 15px;
    }

    .failure-title {
        font-size: 1.8em;
    }

    .failure-message {
        font-size: 1em;
    }

    .failure-icon {
        font-size: 2.5em;
    }

    .token-setup {
        padding: 15px;
    }

    .token-setup h2 {
        font-size: 1.3em;
    }

    .steps {
        padding: 12px;
        font-size: 14px;
    }

    .token-input {
        font-size: 14px;
        padding: 12px;
    }

    .token-button {
        font-size: 14px;
        padding: 12px 20px;
    }
}

/* Email notification modal */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.notification-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    min-height: 20px;
}

.notification-status.pending {
    background: #fff3cd;
    color: #856404;
}

.notification-status.success {
    background: #d4edda;
    color: #155724;
}

.notification-status.error {
    background: #f8d7da;
    color: #721c24;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    text-align: center;
}

.modal-content h3 {
    margin: 0 0 15px 0;
    color: #333;
}

.modal-content p {
    margin: 0 0 20px 0;
    color: #666;
}

.modal-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.modal-button-primary {
    background: #007bff;
    color: white;
}

.modal-button-primary:hover {
    background: #0056b3;
}

.modal-button-secondary {
    background: #6c757d;
    color: white;
}

.modal-button-secondary:hover {
    background: #545b62;
}

.test-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    min-height: 20px;
}

.test-status.pending {
    background: #fff3cd;
    color: #856404;
}

.test-status.success {
    background: #d4edda;
    color: #155724;
}