/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    padding-bottom: 100px; /* Space for bottom navigation */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.app-header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 15px 0;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #007bff;
    margin: 0;
}

/* User Info in Header */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.username {
    color: #666;
    font-weight: 500;
}

.change-user-btn {
    text-decoration: none;
    font-size: 1.2rem;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.change-user-btn:hover {
    background-color: #f0f0f0;
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .user-info {
        font-size: 0.8rem;
    }
}

/* Main Content */
.main-content {
    margin-top: 80px;
    min-height: calc(100vh - 180px);
    padding-bottom: 20px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    padding: 10px 0;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
    z-index: 1000;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    text-decoration: none;
    color: rgba(255,255,255,0.7);
    transition: all 0.3s ease;
    border-radius: 15px;
    margin: 0 5px;
}

.nav-btn:hover,
.nav-btn.active {
    color: white;
    background-color: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

.nav-btn.home-btn {
    transform: scale(1);
}

.nav-btn.home-btn:hover,
.nav-btn.home-btn.active {
    transform: scale(1) translateY(-2px);
}

.nav-icon {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.nav-label {
    font-size: 0.8rem;
    font-weight: 600;
}

/* Flash Messages */
.flash-messages {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 1001;
    max-width: 400px;
}

.alert {
    padding: 12px 20px;
    margin-bottom: 10px;
    border-radius: 5px;
    position: relative;
    animation: slideIn 0.3s ease;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.close-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Home Page Styles */
.home-container {
    padding: 20px 0;
}

.welcome-section {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
}

.welcome-section h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.welcome-section p {
    font-size: 1.1rem;
    color: #666;
}

.create-task-section {
    margin-bottom: 2rem;
}

.create-task-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.create-task-card h2 {
    color: #333;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.3rem;
}

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

.task-input,
.task-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.task-input:focus,
.task-textarea:focus {
    outline: none;
    border-color: #007bff;
}

.task-textarea {
    resize: vertical;
    min-height: 60px;
}

.create-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tasks-section {
    margin-bottom: 2rem;
}

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

.section-header h2 {
    color: #333;
    font-size: 1.5rem;
    margin: 0;
}

.view-all-link {
    color: #007bff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.task-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-left: 4px solid #007bff;
    transition: all 0.3s ease;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.task-card.completed {
    background-color: #f0f9f0;
    border-left-color: #28a745;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.task-title {
    color: #333;
    margin: 0;
    font-size: 1.2rem;
    flex: 1;
    line-height: 1.3;
}

.task-description {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
    font-size: 0.95rem;
}

.task-meta {
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.4;
}

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

.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background-color: #545b62;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    font-size: 1rem;
}

/* History Page */
.history-container {
    padding: 20px 0;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.page-header p {
    color: #666;
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-icon {
    font-size: 2rem;
}

.stat-info {
    flex: 1;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #007bff;
}

.stat-card.highlight .stat-number {
    color: white;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.stat-card.highlight .stat-label {
    color: rgba(255,255,255,0.8);
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #007bff;
    background: white;
    color: #007bff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.filter-btn.active,
.filter-btn:hover {
    background-color: #007bff;
    color: white;
}

.history-tasks {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-task-card {
    background-color: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.history-task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.history-task-card.completed {
    background-color: #f0f9f0;
    border-color: #28a745;
}

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

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

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

.task-date {
    color: #999;
    font-size: 0.85rem;
}

/* Collection Page */
.collection-container {
    padding: 20px 0;
}

.collection-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.rarity-section {
    margin-bottom: 2rem;
}

.rarity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    color: white;
    font-weight: bold;
}

.rarity-header.bronze { background-color: #d76d1b; }
.rarity-header.silber { background-color: #6c757d; }
.rarity-header.gold { background-color: #ffc107; color: #333; }

.rarity-title {
    margin: 0;
    font-size: 1.3rem;
}

.rarity-count {
    font-size: 0.9rem;
    opacity: 0.9;
}

.rewards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.reward-card {
    background: white;
    color: #333;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 3px solid #ddd;
    position: relative;
    text-align: center;
    transition: transform 0.3s ease;
}

.reward-card:hover {
    transform: translateY(-5px);
}

.reward-card.common { border-color: #6c757d; }
.reward-card.uncommon { border-color: #17a2b8; }
.reward-card.rare { border-color: #ffc107; }
.reward-card.epic { border-color: #6f42c1; }
.reward-card.legendary { border-color: #fd7e14; }

.reward-icon-large {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.reward-name {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.reward-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    margin-bottom: 1rem;
}

.value-amount {
    font-weight: bold;
    color: #007bff;
    font-size: 1.2rem;
}

.value-label {
    color: #666;
    font-size: 0.9rem;
}

.empty-collection {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.empty-collection .empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-collection h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

/* Enhanced Form Styling */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.form-select {
    width: 100%;
    padding: 14px 40px 14px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    background-color: white;
    color: #333;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.form-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1), 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.form-select:hover {
    border-color: #007bff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.form-select option {
    padding: 12px;
    background-color: white;
    color: #333;
    font-size: 15px;
}

.form-select option:hover {
    background-color: #f8f9fa;
}

/* Button Pulse Animation */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.btn-pulse {
    animation: pulse 0.6s ease-in-out;
}

/* Enhanced Task Cards */
.task-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border-color: #007bff;
}

.task-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.task-icon {
    font-size: 2.2rem;
    margin-right: 1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.task-details h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    color: #2c3e50;
    font-weight: 600;
}

.task-id {
    margin: 0;
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
}

/* Enhanced Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.empty-state h3 {
    color: #495057;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 1rem;
    opacity: 0.8;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 35px 12px 14px;
    }
    
    .task-card {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1.25rem;
    }
    
    .task-content {
        justify-content: center;
        text-align: center;
    }
    
    .task-icon {
        margin-right: 0.5rem;
        font-size: 2rem;
    }
    .container {
        padding: 0 15px;
    }

    .welcome-section h1 {
        font-size: 2rem;
    }

    .tasks-grid {
        grid-template-columns: 1fr;
    }

    .history-stats,
    .collection-stats {
        grid-template-columns: 1fr;
    }

    .task-actions {
        flex-direction: column;
    }

    .rewards-grid {
        grid-template-columns: 1fr;
    }

    .nav-icon {
        font-size: 1.5rem;
    }

    .nav-label {
        font-size: 0.7rem;
    }

    .filter-buttons {
        gap: 0.3rem;
    }

    .filter-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

@media screen and (max-width: 480px) {
    .app-logo {
        font-size: 1.2rem;
    }

    .welcome-section h1 {
        font-size: 1.8rem;
    }

    .create-task-card {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .task-card {
        padding: 1rem;
    }
}
