/* Parent Dashboard Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #1e293b;
    -webkit-text-size-adjust: 100%;
}

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

/* Header */
.dashboard-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.dashboard-header h1 {
    font-size: 2rem;
    color: #1e293b;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.btn-secondary:hover {
    background: #cbd5e1;
    transform: translateY(-2px);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background: #dc2626;
}

/* Main Content */
.dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Stats Overview */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
}

/* Section Styles */
section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: #1e293b;
}

/* Hill Chart */
.hill-chart-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hill-chart {
    position: relative;
    width: 100%;
    background: #f8fafc;
    border-radius: 12px;
    padding: 24px;
    border: 2px solid #e2e8f0;
}

#hill-svg {
    width: 100%;
    height: auto;
}

.hill-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.hill-label {
    flex: 1;
    text-align: center;
}

.hill-label.left {
    text-align: left;
}

.hill-label.right {
    text-align: right;
}

.hill-label.center {
    flex: 0;
    padding: 0 16px;
}

/* Quest markers on hill */
.quest-marker {
    cursor: pointer;
    transition: all 0.2s;
}

.quest-marker:hover {
    transform: scale(1.2);
}

.quest-marker-circle {
    fill: #667eea;
    stroke: white;
    stroke-width: 3;
}

.quest-marker-text {
    font-size: 14px;
    font-weight: 600;
    fill: white;
    text-anchor: middle;
    dominant-baseline: middle;
}

/* Hill Legend */
.hill-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 0.875rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
}

/* Pending Rewards */
.pending-rewards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.reward-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #fbbf24;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

.reward-card.earned {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
    }
    50% {
        box-shadow: 0 4px 16px rgba(251, 191, 36, 0.5);
    }
}

.reward-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #10b981;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.reward-card h3 {
    font-size: 1.25rem;
    margin-bottom: 12px;
    color: #92400e;
}

.reward-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.reward-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #78350f;
}

.reward-actions {
    display: flex;
    gap: 8px;
}

.reward-actions .btn {
    flex: 1;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #64748b;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.125rem;
}

/* Active Quests Grid */
.quests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.quest-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.quest-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

.quest-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.quest-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.quest-difficulty {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.quest-difficulty.easy {
    background: #dcfce7;
    color: #166534;
}

.quest-difficulty.medium {
    background: #fef3c7;
    color: #92400e;
}

.quest-difficulty.hard {
    background: #fee2e2;
    color: #991b1b;
}

.quest-description {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 16px;
    line-height: 1.5;
}

.quest-rewards {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.quest-reward-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
}

/* Completed Quests */
.completed-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.completed-quest-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #10b981;
}

.completed-quest-info {
    flex: 1;
}

.completed-quest-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.completed-quest-meta {
    font-size: 0.875rem;
    color: #64748b;
}

.completed-quest-rewards {
    display: flex;
    gap: 12px;
    font-size: 0.875rem;
    font-weight: 600;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: #1e293b;
}

.modal-content p {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 24px;
    line-height: 1.6;
}

/* Modal close button (top-right X) */
.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f44336;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
}

.modal-close-btn:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

.modal-actions {
    display: flex;
    gap: 12px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 12px;
    }

    .dashboard-header {
        padding: 16px;
    }

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

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .header-actions .btn {
        width: 100%;
    }

    section {
        padding: 20px;
    }

    .stats-overview {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .stat-card {
        padding: 16px;
    }

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

    .stat-value {
        font-size: 1.5rem;
    }

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

    .modal-content {
        width: 95%;
        padding: 24px;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .dashboard-container {
        padding: 8px;
    }

    .dashboard-header {
        padding: 12px;
        border-radius: 12px;
    }

    .dashboard-header h1 {
        font-size: 1.3rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    section {
        padding: 16px;
        border-radius: 12px;
    }

    section h2 {
        font-size: 1.3rem;
    }

    .stats-overview {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

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

    .reward-card,
    .quest-card {
        padding: 14px;
    }

    .modal-content {
        width: 98%;
        padding: 20px;
        border-radius: 12px;
    }

    .modal-content h3 {
        font-size: 1.2rem;
        margin-top: 30px;
    }

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

    .modal-actions .btn {
        width: 100%;
    }
}

/* Landscape mode for mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .dashboard-header h1 {
        font-size: 1.3rem;
    }

    .stats-overview {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

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

    .stat-value {
        font-size: 1.2rem;
    }

    section {
        padding: 16px;
    }

    .modal-content {
        max-width: 600px;
        max-height: 95vh;
    }
}
