/* CSS Variables */
:root {
    --primary-blue: #2563eb;
    --primary-blue-hover: #1d4ed8;
    --success-green: #16a34a;
    --success-green-light: #dcfce7;
    --danger-red: #dc2626;
    --danger-red-light: #fee2e2;
    --warning-orange: #ea580c;
    --warning-orange-light: #ffedd5;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --gold: #fbbf24;
    --silver: #9ca3af;
    --bronze: #d97706;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--gray-900);
    background-color: var(--gray-100);
    min-height: 100vh;
}

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* Login Container */
.login-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background-color: var(--gray-100);
}

.login-container.active {
    display: flex;
}

.login-card {
    width: 100%;
    max-width: 24rem;
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

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

.login-header h1 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.login-header p {
    margin: 0;
    color: var(--gray-500);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background-color: white;
    color: var(--gray-900);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    min-height: 5rem;
    resize: vertical;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s, opacity 0.15s;
}

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

.btn-primary {
    background-color: var(--primary-blue);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-blue-hover);
}

.btn-success {
    background-color: var(--success-green);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #15803d;
}

.btn-danger {
    background-color: var(--danger-red);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #b91c1c;
}

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--gray-300);
}

.btn-block {
    width: 100%;
}

.login-error {
    display: none;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: var(--danger-red-light);
    color: var(--danger-red);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

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

/* Main App */
.app-container {
    display: none;
    flex-direction: column;
    min-height: 100vh;
}

.app-container.active {
    display: flex;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-greeting {
    font-weight: 600;
    color: var(--gray-900);
}

.location-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background-color: var(--gray-100);
    color: var(--gray-600);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.points-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background-color: var(--primary-blue);
    color: white;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.875rem;
}

.points-badge::before {
    content: '\2605';
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    background-color: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 60px;
    z-index: 99;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--gray-500);
    font-weight: 500;
    transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
    color: var(--gray-700);
}

.tab-btn.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
}

/* Tab Content */
.tab-content {
    flex: 1;
    padding: 1rem;
    padding-bottom: 5rem;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.progress-badge {
    padding: 0.25rem 0.75rem;
    background-color: var(--success-green-light);
    color: var(--success-green);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Task List */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background-color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow 0.15s;
}

.task-item:hover {
    box-shadow: var(--shadow);
}

.task-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, border-color 0.15s;
}

.task-item.completed .task-checkbox {
    background-color: var(--success-green);
    border-color: var(--success-green);
}

.task-item.completed .task-checkbox::after {
    content: '\2713';
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-name {
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 0.125rem;
}

.task-item.completed .task-name {
    color: var(--gray-400);
    text-decoration: line-through;
}

.task-description {
    font-size: 0.875rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-item.completed .task-description {
    color: var(--gray-400);
}

.task-points {
    padding: 0.25rem 0.5rem;
    background-color: var(--gray-100);
    color: var(--gray-600);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.task-item.completed .task-points {
    background-color: var(--gray-50);
    color: var(--gray-400);
}

/* Verify List */
.verify-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background-color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow 0.15s;
}

.verify-item:hover {
    box-shadow: var(--shadow);
}

.verify-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.verify-item-info {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.verify-badge {
    padding: 0.25rem 0.5rem;
    background-color: var(--warning-orange-light);
    color: var(--warning-orange);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-700);
}

.empty-state-text {
    margin: 0;
}

/* Leaderboard */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.leaderboard-rank {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
    background-color: var(--gold);
    color: white;
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
    background-color: var(--silver);
    color: white;
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
    background-color: var(--bronze);
    color: white;
}

.leaderboard-item:nth-child(n+4) .leaderboard-rank {
    background-color: var(--gray-100);
    color: var(--gray-600);
}

.leaderboard-user {
    flex: 1;
    min-width: 0;
}

.leaderboard-name {
    font-weight: 500;
    color: var(--gray-900);
}

.leaderboard-location {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.leaderboard-points {
    font-weight: 600;
    color: var(--primary-blue);
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.visible {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    background-color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow-y: auto;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@media (min-width: 640px) {
    .modal-overlay {
        align-items: center;
    }

    .modal {
        border-radius: var(--radius-lg);
        max-height: 80vh;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-full);
    color: var(--gray-500);
    font-size: 1.25rem;
    transition: background-color 0.15s;
}

.modal-close:hover {
    background-color: var(--gray-100);
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
}

.modal-footer .btn {
    flex: 1;
}

/* Task Modal */
.task-modal-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--gray-900);
}

.task-modal-description {
    color: var(--gray-600);
    margin-bottom: 1.5rem;
}

/* Verify Modal */
.verify-modal-info {
    padding: 1rem;
    background-color: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.verify-modal-completed-by {
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.verify-modal-time {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.verify-modal-note {
    padding: 1rem;
    background-color: var(--gray-100);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.verify-modal-note-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.verify-modal-note-text {
    color: var(--gray-700);
}

/* Settings Modal */
.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
}

/* FAB Button */
.fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    background-color: var(--gray-800);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 50;
    transition: background-color 0.15s, transform 0.15s;
}

.fab:hover {
    background-color: var(--gray-900);
    transform: scale(1.05);
}

.fab-icon {
    width: 1.5rem;
    height: 1.5rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive adjustments */
@media (min-width: 640px) {
    .tab-content {
        max-width: 40rem;
        margin: 0 auto;
    }

    .app-header {
        padding: 1rem 2rem;
    }

    .tab-nav {
        max-width: 40rem;
        margin: 0 auto;
    }
}
