/**
 * City Stories Map - Frontend Styles
 */

/* === Map Container === */
.csm-map-container {
    position: relative;
    width: 100%;
    margin: 30px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#csm-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.csm-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.csm-map-loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === Modal === */
.csm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.csm-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.csm-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.csm-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s;
}

.csm-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.csm-modal-body {
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
}

/* === Story Popup === */
.csm-story-popup {
    color: #333;
}

.csm-story-featured-image {
    margin: -30px -30px 20px;
    overflow: hidden;
}

.csm-story-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.csm-story-title {
    font-size: 28px;
    margin: 0 0 15px;
    color: #222;
}

.csm-story-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.csm-level-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #3498db;
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 5px;
}

.csm-story-tags {
    margin-bottom: 20px;
}

.csm-tag {
    display: inline-block;
    padding: 4px 12px;
    margin: 0 5px 5px 0;
    background: #ecf0f1;
    border-radius: 15px;
    font-size: 13px;
}

.csm-story-content {
    margin: 20px 0;
    line-height: 1.7;
}

.csm-story-content p {
    margin-bottom: 15px;
}

/* === Media Tabs === */
.csm-story-media {
    margin: 30px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.csm-media-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.csm-tab-button {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s;
}

.csm-tab-button:hover {
    background: #e9ecef;
}

.csm-tab-button.active {
    background: #fff;
    color: #3498db;
    border-bottom: 2px solid #3498db;
}

.csm-tab-panel {
    display: none;
    padding: 20px;
}

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

.csm-tab-panel audio,
.csm-tab-panel video {
    width: 100%;
    max-width: 100%;
}

.csm-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.csm-gallery-item img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    cursor: pointer;
}

/* === Story Footer === */
.csm-story-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.csm-qr-code {
    flex: 1;
}

.csm-qr-toggle {
    padding: 8px 16px;
    background: #ecf0f1;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.csm-qr-display {
    margin-top: 15px;
    text-align: center;
}

.csm-qr-display img {
    max-width: 200px;
    height: auto;
}

/* === Buttons === */
.csm-button {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
}

.csm-button-primary {
    background: #3498db;
    color: #fff;
}

.csm-button-primary:hover {
    background: #2980b9;
    color: #fff;
}

.csm-button-secondary {
    background: #95a5a6;
    color: #fff;
}

.csm-button-secondary:hover {
    background: #7f8c8d;
}

.csm-button-danger {
    background: #e74c3c;
    color: #fff;
}

.csm-button-danger:hover {
    background: #c0392b;
}

.csm-button-small {
    padding: 6px 12px;
    font-size: 13px;
}

/* === Submission Form === */
.csm-submission-form {
    max-width: 900px;
    margin: 30px auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.csm-form-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.csm-form-section:last-child {
    border-bottom: none;
}

.csm-form-section h3 {
    margin: 0 0 20px;
    font-size: 20px;
    color: #333;
}

.csm-form-field {
    margin-bottom: 20px;
}

.csm-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.csm-form-field .required {
    color: #e74c3c;
}

.csm-form-field input[type="text"],
.csm-form-field input[type="url"],
.csm-form-field input[type="email"],
.csm-form-field textarea,
.csm-form-field select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
}

.csm-form-field textarea {
    resize: vertical;
    min-height: 120px;
}

.csm-form-field input[type="file"] {
    display: block;
    margin-top: 8px;
}

.csm-help-text {
    margin: 8px 0 0;
    font-size: 13px;
    color: #666;
}

.csm-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.csm-form-actions {
    text-align: center;
    margin-top: 30px;
}

.csm-form-note {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
}

.csm-form-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

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

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

/* === User Dashboard === */
.csm-user-dashboard {
    max-width: 1200px;
    margin: 30px auto;
}

.csm-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.csm-stat-card {
    display: flex;
    align-items: center;
    padding: 25px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.csm-stat-icon {
    font-size: 48px;
    margin-right: 20px;
}

.csm-stat-content h3 {
    margin: 0;
    font-size: 32px;
    color: #333;
}

.csm-stat-content p {
    margin: 5px 0 0;
    font-size: 14px;
    color: #666;
}

.csm-level-progress {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.csm-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.csm-progress-bar {
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
}

.csm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    transition: width 0.3s;
}

.csm-badges-section {
    margin-bottom: 30px;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.csm-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.csm-badge {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: help;
}

.csm-badge-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.csm-badge-name {
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

.csm-user-stories-section {
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.csm-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.csm-story-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.csm-story-thumbnail {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 4px;
    overflow: hidden;
}

.csm-story-thumbnail img,
.csm-no-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #ecf0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.csm-story-info {
    flex: 1;
}

.csm-story-info h4 {
    margin: 0 0 10px;
}

.csm-story-info h4 a {
    color: #333;
    text-decoration: none;
}

.csm-story-info h4 a:hover {
    color: #3498db;
}

.csm-story-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #666;
}

.csm-status {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.csm-status-publish {
    background: #d4edda;
    color: #155724;
}

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

.csm-status-draft {
    background: #e2e3e5;
    color: #383d41;
}

.csm-story-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* === Leaderboard === */
.csm-leaderboard {
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.csm-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.csm-leaderboard-table th,
.csm-leaderboard-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.csm-leaderboard-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.csm-leaderboard-table .rank-1 {
    background: #fff9e6;
}

.csm-leaderboard-table .rank-2 {
    background: #f5f5f5;
}

.csm-leaderboard-table .rank-3 {
    background: #fff0e6;
}

.medal {
    font-size: 24px;
}

.csm-leaderboard-table .avatar img {
    border-radius: 50%;
}

.level-title {
    display: block;
    font-size: 12px;
    color: #666;
}

/* === Notices === */
.csm-notice {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.csm-notice-info {
    background: #e7f3ff;
    border-color: #3498db;
    color: #1976d2;
}

.csm-notice a {
    color: inherit;
    text-decoration: underline;
}

/* === Responsive === */
@media (max-width: 768px) {
    .csm-modal-content {
        width: 95%;
    }
    
    .csm-modal-body {
        padding: 20px;
    }
    
    .csm-story-title {
        font-size: 22px;
    }
    
    .csm-submission-form {
        padding: 20px;
    }
    
    .csm-form-row {
        grid-template-columns: 1fr;
    }
    
    .csm-dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .csm-story-item {
        flex-direction: column;
    }
    
    .csm-story-thumbnail {
        width: 100%;
        height: 200px;
    }
}

/* ========================================
   PHASE 2 STYLES - Search, Filters, GPS, Likes, Share
   ======================================== */

/* Map Wrapper */
.csm-map-wrapper {
    width: 100%;
    margin: 20px 0;
}

/* Map Controls Container */
.csm-map-controls {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Search Bar */
.csm-search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.csm-search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.csm-search-input:focus {
    outline: none;
    border-color: #3498db;
}

.csm-btn-search {
    padding: 12px 24px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.csm-btn-search:hover {
    background: #2980b9;
}

/* Filters Row */
.csm-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 15px;
}

.csm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}

.csm-filter-group label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.csm-select,
.csm-date-input {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.3s;
}

.csm-select:focus,
.csm-date-input:focus {
    outline: none;
    border-color: #3498db;
}

/* GPS Button */
.csm-btn-gps {
    padding: 10px 20px;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
    align-self: flex-end;
}

.csm-btn-gps:hover {
    background: #229954;
}

/* Clear Button */
.csm-btn-clear {
    padding: 10px 20px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
    align-self: flex-end;
}

.csm-btn-clear:hover {
    background: #c0392b;
}

/* Results Info */
.csm-results-info {
    padding: 10px 0;
    border-top: 1px solid #e0e0e0;
}

.csm-results-text {
    font-size: 14px;
    color: #666;
}

.csm-results-text strong {
    color: #333;
    font-weight: 600;
}

/* Story Actions (Like/Share Buttons) */
.csm-story-actions {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    padding: 15px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.csm-btn-like,
.csm-btn-share,
.csm-btn-view {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    text-decoration: none;
    color: #333;
}

.csm-btn-like:hover,
.csm-btn-share:hover,
.csm-btn-view:hover {
    border-color: #3498db;
    color: #3498db;
    background: #f8f9fa;
}

.csm-btn-like.liked {
    background: #ffe6e6;
    border-color: #e74c3c;
    color: #e74c3c;
}

.csm-btn-like .icon {
    font-size: 18px;
}

/* Share Menu */
.csm-share-menu {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin: 10px 0;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: opacity 0.3s;
    text-decoration: none;
}

.share-btn:hover {
    opacity: 0.9;
}

.share-btn.facebook {
    background: #1877f2;
    color: #fff;
}

.share-btn.twitter {
    background: #000;
    color: #fff;
}

.share-btn.whatsapp {
    background: #25d366;
    color: #fff;
}

.share-btn.copy {
    background: #6c757d;
    color: #fff;
}

/* Story Statistics */
.csm-story-stats {
    display: flex;
    gap: 20px;
    margin: 15px 0;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #666;
}

.stat-item .icon {
    font-size: 16px;
}

.stat-item .count {
    font-weight: 600;
    color: #333;
}

/* Responsive - Phase 2 */
@media (max-width: 768px) {
    .csm-filters-row {
        flex-direction: column;
    }
    
    .csm-filter-group {
        width: 100%;
        min-width: 0;
    }
    
    .csm-search-bar {
        flex-direction: column;
    }
    
    .csm-story-actions {
        flex-direction: column;
    }
    
    .csm-btn-like,
    .csm-btn-share,
    .csm-btn-view {
        width: 100%;
        justify-content: center;
    }
    
    .csm-share-menu {
        flex-direction: column;
    }
    
    .share-btn {
        width: 100%;
        justify-content: center;
    }
    
    .csm-story-stats {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* ========================================
   MULTI-STEP FORM
   ======================================== */

/* Progress Indicator */
.csm-form-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

.csm-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
}

.csm-progress-step .step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.csm-progress-step .step-label {
    font-size: 14px;
    color: #999;
    font-weight: 500;
    transition: color 0.3s ease;
}

.csm-progress-step.active .step-number {
    background: #3498db;
    color: #fff;
    box-shadow: 0 3px 10px rgba(52, 152, 219, 0.3);
}

.csm-progress-step.active .step-label {
    color: #3498db;
}

.csm-progress-step.completed .step-number {
    background: #27ae60;
    color: #fff;
}

.csm-progress-step.completed .step-number::before {
    content: "✓";
    font-size: 24px;
}

.csm-progress-step.completed .step-label {
    color: #27ae60;
}

.csm-progress-line {
    width: 100px;
    height: 3px;
    background: #e0e0e0;
    margin: 0 10px 35px 10px;
    transition: background 0.3s ease;
}

.csm-progress-step.completed + .csm-progress-line {
    background: #27ae60;
}

/* Form Steps */
.csm-form-step {
    display: none;
    animation: fadeIn 0.4s ease;
}

.csm-form-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.csm-form-step h3 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
}

/* Navigation Buttons */
.csm-form-navigation {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.csm-form-navigation .csm-button {
    flex: 1;
    max-width: 200px;
    padding: 14px 30px;
    font-size: 16px;
}

.csm-form-navigation .csm-button:only-child {
    margin-left: auto;
}

/* Step-specific styling */
.csm-form-step[data-step="1"] textarea {
    min-height: 200px;
}

.csm-form-step[data-step="2"] #csm-location-map {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid #e0e0e0;
}

.csm-form-step[data-step="3"] .csm-form-field {
    margin-bottom: 30px;
}

/* Validation highlighting */
.csm-form-field.error input,
.csm-form-field.error textarea {
    border-color: #e74c3c;
}

.csm-form-field.error label {
    color: #e74c3c;
}

.csm-validation-message {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 5px;
    display: none;
}

.csm-form-field.error .csm-validation-message {
    display: block;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .csm-form-progress {
        padding: 20px 0;
        margin-bottom: 30px;
    }
    
    .csm-progress-step .step-number {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .csm-progress-step .step-label {
        font-size: 12px;
    }
    
    .csm-progress-line {
        width: 50px;
        margin: 0 5px 30px 5px;
    }
    
    .csm-form-step h3 {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .csm-form-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .csm-form-navigation .csm-button {
        max-width: 100%;
    }
}

/* ========================================
   STORY POPUP - SHARE BUTTONS & QR CODE
   ======================================== */

/* Share Section */
.csm-share-section {
    margin: 30px 0;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 8px;
}

.csm-share-title {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.csm-share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.csm-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    color: #333;
}

.csm-share-btn svg {
    flex-shrink: 0;
}

.csm-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.csm-share-facebook {
    background: #1877f2;
    color: #fff;
    border-color: #1877f2;
}

.csm-share-facebook:hover {
    background: #0d65d9;
    border-color: #0d65d9;
    color: #fff;
}

.csm-share-twitter {
    background: #000;
    color: #fff;
    border-color: #000;
}

.csm-share-twitter:hover {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}

.csm-share-whatsapp {
    background: #25d366;
    color: #fff;
    border-color: #25d366;
}

.csm-share-whatsapp:hover {
    background: #1faa52;
    border-color: #1faa52;
    color: #fff;
}

.csm-share-copy {
    background: #fff;
    color: #333;
    border-color: #ddd;
}

.csm-share-copy:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

/* QR Code Section */
.csm-qr-code {
    margin: 25px 0;
    text-align: center;
}

.csm-qr-toggle {
    padding: 12px 24px;
    background: #fff;
    border: 2px solid #3498db;
    border-radius: 6px;
    color: #3498db;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.csm-qr-toggle:hover {
    background: #3498db;
    color: #fff;
}

.csm-qr-display {
    margin-top: 20px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.csm-qr-display img {
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0 auto 10px;
}

.csm-qr-display p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Story Footer */
.csm-story-footer {
    padding: 30px 0 0;
    border-top: 2px solid #f0f0f0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .csm-share-buttons {
        flex-direction: column;
    }
    
    .csm-share-btn {
        width: 100%;
        justify-content: center;
    }
    
    .csm-qr-display img {
        max-width: 150px;
    }
}

/* ========================================
   STORY MODAL
   ======================================== */

.csm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.csm-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
}

.csm-modal-container {
    position: relative;
    max-width: 800px;
    max-height: 90vh;
    margin: 5vh auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.csm-modal-header {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    z-index: 10;
}

.csm-modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #666;
    transition: color 0.3s ease;
    border-radius: 4px;
}

.csm-modal-close:hover {
    color: #000;
    background: #f0f0f0;
}

.csm-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.csm-loading {
    text-align: center;
    padding: 60px 20px;
}

.csm-loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: csm-spin 0.8s linear infinite;
}

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

.csm-loading p {
    margin-top: 20px;
    color: #666;
}

/* Story Popup Content */
.csm-story-popup {
    /* Already styled in story popup section */
}

.csm-story-header {
    margin-bottom: 30px;
}

.csm-story-featured-image {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.csm-story-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.csm-story-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 15px 0;
    color: #2c3e50;
    line-height: 1.3;
}

.csm-story-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.csm-story-meta strong {
    color: #333;
}

.csm-level-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #3498db;
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 5px;
}

.csm-story-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.csm-tag {
    display: inline-block;
    padding: 6px 12px;
    background: #f0f0f0;
    color: #333;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.csm-tag.csm-category {
    background: #e3f2fd;
    color: #1976d2;
}

.csm-tag.csm-type {
    background: #f3e5f5;
    color: #7b1fa2;
}

.csm-story-content {
    margin: 30px 0;
    line-height: 1.8;
    color: #333;
    font-size: 16px;
}

.csm-story-content p {
    margin-bottom: 1em;
}

.csm-story-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .csm-modal-container {
        max-width: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .csm-modal-body {
        padding: 20px;
    }
    
    .csm-story-title {
        font-size: 22px;
    }
    
    .csm-story-meta {
        flex-direction: column;
        gap: 8px;
    }
}

/* ========================================
   QR CODE ACTIONS
   ======================================== */

.csm-qr-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.csm-qr-actions .csm-button {
    flex: 1;
    min-width: 140px;
    padding: 10px 16px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.csm-qr-actions .csm-button:hover {
    transform: translateY(-2px);
}

@media (max-width: 480px) {
    .csm-qr-actions {
        flex-direction: column;
    }
    
    .csm-qr-actions .csm-button {
        width: 100%;
    }
}

/* ========================================

/* ========================================
   USER DASHBOARD - MODERN DESIGN
   ======================================== */

.csm-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Dashboard Header */
.csm-dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 30px;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.csm-user-profile {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
}

.csm-avatar-wrapper {
    position: relative;
}

.csm-avatar-wrapper img {
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.3);
    width: 120px;
    height: 120px;
}

.csm-level-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.csm-level-number {
    font-size: 18px;
    font-weight: bold;
    color: white;
}

.csm-user-info {
    flex: 1;
}

.csm-user-name {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: white;
}

.csm-user-title {
    font-size: 20px;
    margin: 0 0 5px 0;
    opacity: 0.9;
}

.csm-user-email {
    font-size: 14px;
    margin: 0;
    opacity: 0.8;
}

/* Level Progress */
.csm-level-progress-container {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.csm-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.csm-progress-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.csm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.csm-progress-text {
    text-align: center;
    font-size: 13px;
    margin: 0;
    opacity: 0.9;
}

/* Stats Grid */
.csm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.csm-stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.csm-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.csm-stat-icon {
    font-size: 36px;
    line-height: 1;
}

.csm-stat-content {
    flex: 1;
}

.csm-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
}

.csm-stat-label {
    font-size: 13px;
    color: #7f8c8d;
    margin-top: 2px;
}

/* Dashboard Section */
.csm-dashboard-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.csm-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.csm-section-title {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.csm-title-icon {
    font-size: 28px;
}

/* Badges Grid */
.csm-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.csm-badge-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.csm-badge-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.csm-badge-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.csm-badge-name {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 8px 0;
}

.csm-badge-description {
    font-size: 13px;
    color: #7f8c8d;
    margin: 0;
}

/* Stories List */
.csm-stories-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.csm-story-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.csm-story-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.csm-story-thumbnail {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
}

.csm-story-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.csm-story-content {
    flex: 1;
    min-width: 0;
}

.csm-story-header {
    margin-bottom: 10px;
}

.csm-story-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.csm-story-title a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.csm-story-title a:hover {
    color: #3498db;
}

.csm-story-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.csm-category-tag {
    display: inline-block;
    padding: 3px 10px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.csm-story-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 13px;
    color: #7f8c8d;
}

.csm-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.csm-meta-icon {
    font-size: 14px;
}

.csm-story-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.csm-action-button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    font-size: 18px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.csm-action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Empty State */
.csm-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.csm-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.csm-empty-state h3 {
    font-size: 24px;
    color: #2c3e50;
    margin: 0 0 10px 0;
}

.csm-empty-state p {
    font-size: 16px;
    color: #7f8c8d;
    margin: 0 0 25px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .csm-dashboard {
        padding: 20px 15px;
    }
    
    .csm-dashboard-header {
        padding: 30px 20px;
    }
    
    .csm-user-profile {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .csm-user-name {
        font-size: 24px;
    }
    
    .csm-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .csm-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .csm-section-header .csm-button {
        width: 100%;
    }
    
    .csm-badges-grid {
        grid-template-columns: 1fr;
    }
    
    .csm-story-item {
        flex-direction: column;
    }
    
    .csm-story-thumbnail {
        width: 100%;
        height: 200px;
    }
    
    .csm-story-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .csm-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .csm-stat-card {
        padding: 20px;
    }
    
    .csm-stat-icon {
        font-size: 32px;
    }
    
    .csm-stat-value {
        font-size: 24px;
    }
}

/* ========================================
   LEADERBOARD - MODERN DESIGN
   ======================================== */

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

/* Header */
.csm-leaderboard-header {
    text-align: center;
    margin-bottom: 50px;
}

.csm-leaderboard-title {
    font-size: 36px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.csm-leaderboard-subtitle {
    font-size: 16px;
    color: #7f8c8d;
    margin: 0;
}

/* Podium (Top 3) */
.csm-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 50px;
    perspective: 1000px;
}

.csm-podium-item {
    background: white;
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: all 0.3s ease;
    flex: 0 0 280px;
}

.csm-podium-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

/* 1st Place (Center - Tallest) */
.csm-podium-item.rank-1 {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: white;
    transform: translateY(-20px);
    order: 2;
}

.csm-podium-item.rank-1 .csm-podium-avatar {
    width: 120px;
    height: 120px;
}

.csm-podium-item.rank-1 .csm-podium-medal {
    font-size: 48px;
}

/* 2nd Place (Left) */
.csm-podium-item.rank-2 {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
    color: white;
    transform: translateY(-10px);
    order: 1;
}

.csm-podium-item.rank-2 .csm-podium-avatar {
    width: 100px;
    height: 100px;
}

/* 3rd Place (Right) */
.csm-podium-item.rank-3 {
    background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
    color: white;
    order: 3;
}

.csm-podium-item.rank-3 .csm-podium-avatar {
    width: 100px;
    height: 100px;
}

.csm-podium-medal {
    font-size: 40px;
    margin-bottom: 15px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.csm-podium-avatar {
    width: 100px;
    height: 100px;
    margin: 0 auto 15px;
    position: relative;
}

.csm-podium-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

.csm-podium-rank {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    border: 3px solid white;
}

.csm-podium-name {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 5px 0;
}

.csm-podium-title {
    font-size: 14px;
    opacity: 0.9;
    margin: 0 0 15px 0;
}

.csm-podium-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding-top: 15px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.csm-podium-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.csm-podium-stat-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.csm-podium-stat-label {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Current User Highlight */
.csm-podium-item.is-current-user {
    border: 3px solid #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2), 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Rankings List (4+) */
.csm-rankings {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.csm-rankings-title {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 25px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.csm-rankings-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.csm-ranking-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.csm-ranking-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.csm-ranking-item.is-current-user {
    background: #e3f2fd;
    border: 2px solid #3498db;
}

.csm-ranking-rank {
    font-size: 24px;
    font-weight: 700;
    color: #7f8c8d;
    min-width: 40px;
    text-align: center;
}

.csm-ranking-avatar {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.csm-ranking-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid white;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.csm-ranking-name {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 4px 0;
}

.csm-ranking-title {
    font-size: 14px;
    color: #7f8c8d;
    margin: 0;
}

.csm-ranking-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.csm-ranking-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #2c3e50;
}

.csm-ranking-stat .csm-stat-icon {
    font-size: 16px;
}

.csm-ranking-stat .csm-stat-value {
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .csm-leaderboard-title {
        font-size: 28px;
    }
    
    .csm-podium {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .csm-podium-item {
        flex: 0 0 auto;
        width: 100%;
        max-width: 320px;
    }
    
    .csm-podium-item.rank-1,
    .csm-podium-item.rank-2,
    .csm-podium-item.rank-3 {
        transform: translateY(0);
        order: initial;
    }
    
    .csm-ranking-item {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .csm-ranking-rank {
        min-width: 30px;
        font-size: 20px;
    }
    
    .csm-ranking-avatar {
        width: 50px;
        height: 50px;
    }
    
    .csm-ranking-stats {
        width: 100%;
        justify-content: space-between;
        padding-top: 10px;
        border-top: 1px solid #dee2e6;
    }
}

@media (max-width: 480px) {
    .csm-leaderboard-container {
        padding: 20px 15px;
    }
    
    .csm-ranking-name {
        font-size: 16px;
    }
    
    .csm-ranking-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* Single user podium */
.csm-podium .csm-podium-item:only-child {
    max-width: 400px;
    margin: 0 auto;
}

/* Two users podium */
.csm-podium:has(.csm-podium-item:nth-child(2):last-child) {
    justify-content: center;
    gap: 30px;
}

.csm-podium:has(.csm-podium-item:nth-child(2):last-child) .csm-podium-item {
    max-width: 350px;
}