/* SoftSins Dashboard Styles */

/* Loading & Access States */
.loading-screen,
.access-denied {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content,
.access-content {
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--gray-lighter);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Loading state for play buttons */
.play-btn[data-status="loading"] {
    pointer-events: none;
    position: relative;
    color: transparent; /* Hide original ▶ */
}

.play-btn[data-status="loading"]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #FFFFFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.play-btn[data-status="timeout"] {
    color: transparent;
}

.play-btn[data-status="timeout"]::before {
    content: '⚠️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #f0ad4e;
}

.btn[data-status="loading"] {
    opacity: 0.7;
    cursor: not-allowed;
}

.access-content h2 {
    color: var(--dark);
    margin-bottom: 15px;
}

.access-content p {
    color: var(--gray);
    margin-bottom: 30px;
}

.access-content .btn {
    margin: 0 10px;
}

/* Dashboard Main */
.dashboard-main {
    min-height: calc(100vh - 140px);
    padding: 80px 0 40px;
    background: var(--off-white);
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    margin-top: 20px;
    padding: 30px;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.user-welcome h1 {
    font-family: var(--font-primary);
    color: var(--dark);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.user-welcome p {
    color: var(--gray);
    font-size: var(--text-lg);
}

.user-avatar {
    display: none; /* Temporarily hidden for redesign */
    align-items: center;
}

.avatar-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 600;
}

/* Dashboard Navigation */
.dashboard-nav {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding: 0 30px;
    overflow-x: auto;
    scrollbar-width: none;
    justify-content: center;
}

.dashboard-nav::-webkit-scrollbar {
    display: none;
}

.dash-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--white);
    border: 2px solid var(--gray-lighter);
    border-radius: var(--radius-lg);
    color: var(--gray);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    min-width: 50px;
    justify-content: center;
}

.nav-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: all 0.3s ease;
}

.nav-text {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    font-weight: 500;
}

.dash-nav-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.dash-nav-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
    padding: 12px 20px;
    min-width: auto;
}

.dash-nav-btn.active .nav-text {
    opacity: 1;
    max-width: 200px;
    margin-left: 8px;
}

.dash-nav-btn.active .nav-icon {
    transform: scale(1.1);
}

/* Dashboard Content */
.dashboard-content {
    padding: 0 30px;
}

.dashboard-section {
    display: none;
}

.dashboard-section.active {
    display: block;
}

.dashboard-section h2 {
    font-family: var(--font-primary);
    color: var(--dark);
    font-size: 2rem;
    margin-bottom: 30px;
}

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

.section-header h2 {
    margin-bottom: 0;
}

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

.stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    border-radius: var(--radius-lg);
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 5px;
}

.stat-content p {
    color: var(--gray);
    font-size: var(--text-sm);
    margin: 0;
}

/* Recent Activity */
.recent-activity {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.recent-activity h3 {
    color: var(--dark);
    margin-bottom: 20px;
}

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

.activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--off-white);
    border-radius: var(--radius-md);
}

.activity-icon {
    font-size: 1.2rem;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 3px;
}

.activity-time {
    font-size: var(--text-xs);
    color: var(--gray);
}

/* Quick Actions */
.quick-actions {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.quick-actions h3 {
    color: var(--dark);
    margin-bottom: 20px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: var(--off-white);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.action-btn:hover {
    border-color: var(--primary-color);
    background: var(--white);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.action-btn .icon {
    font-size: 1.1rem;
}

/* Stories List */
.stories-list {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.story-item {
    border-bottom: 1px solid var(--gray-lighter);
    transition: background-color 0.2s ease;
}

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

.story-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    gap: 12px;
}

.story-header:hover {
    background: var(--off-white);
}

.story-title {
    flex: 1;
    font-weight: 500;
    color: var(--dark);
    font-size: var(--text-base);
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    border: none;
    color: var(--white);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.play-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.play-btn.preview {
    background: var(--gray);
}

.lock-icon {
    width: 20px;
    height: 20px;
    color: var(--gray);
    cursor: pointer;
    transition: color 0.2s ease;
}

.lock-icon:hover {
    color: var(--primary-color);
}

.story-details {
    padding: 0 20px 20px;
    border-top: 1px solid var(--gray-lighter);
    background: var(--off-white);
    display: none;
}

.story-details.expanded {
    display: block;
    animation: slideDown 0.3s ease;
}

.story-description {
    color: var(--gray);
    font-size: var(--text-sm);
    line-height: 1.5;
    margin: 16px 0;
}

.story-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.story-tag {
    background: var(--primary-color);
    color: var(--white);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
}

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

.expand-icon {
    width: 20px;
    height: 20px;
    color: var(--gray);
    transition: transform 0.3s ease, color 0.2s ease;
}

.story-header.expanded .expand-icon {
    transform: rotate(180deg);
    color: var(--primary-color);
}

.no-stories,
.no-content {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.no-content-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.no-stories h3,
.no-content h3 {
    color: var(--dark);
    margin-bottom: 10px;
}

/* Preferences */
.preferences-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.pref-card {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pref-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.pref-card h3 {
    color: var(--dark);
    margin-bottom: 10px;
}

.pref-card p {
    color: var(--gray);
    margin-bottom: 20px;
}

.current-preferences {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--off-white);
    border-radius: var(--radius-md);
}

.pref-tag {
    display: inline-block;
    background: var(--primary-color);
    color: var(--white);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    margin: 2px;
}

.pref-toggles {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--gray-lighter);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--white);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toggle input[type="checkbox"]:checked + .toggle-slider {
    background: var(--primary-color);
}

.toggle input[type="checkbox"]:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Profile */
.profile-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.profile-form {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--dark);
    font-weight: 500;
    margin-bottom: 5px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-lighter);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-input[readonly] {
    background: var(--off-white);
    color: var(--gray);
}

textarea.form-input {
    min-height: 100px;
    resize: vertical;
}

.form-group small {
    color: var(--gray);
    font-size: var(--text-xs);
    margin-top: 5px;
    display: block;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.profile-avatar {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.avatar-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 2rem;
    font-weight: 600;
}

/* Settings */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setting-card {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-card.danger {
    border-left: 4px solid #E53E3E;
}

.setting-card h3 {
    color: var(--dark);
    margin-bottom: 5px;
}

.setting-card p {
    color: var(--gray);
    margin: 0;
}

.btn-danger {
    background: #E53E3E;
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-main {
        padding: 100px 0 20px;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        margin-bottom: 30px;
        margin-top: 10px;
    }
    
    .user-welcome h1 {
        font-size: 2rem;
    }
    
    .dashboard-nav {
        padding: 0 20px;
        gap: 15px;
        flex-wrap: wrap;
    }
    
    .dash-nav-btn {
        min-width: 50px;
        flex: 1;
        max-width: 120px;
    }
    
    .dash-nav-btn.active {
        flex: 2;
        max-width: 180px;
    }
    
    .dashboard-content {
        padding: 0 20px;
    }
    
    .story-header {
        padding: 12px 16px;
    }
    
    .story-title {
        font-size: var(--text-sm);
    }
    
    .play-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .story-details {
        padding: 0 16px 16px;
    }
    
    .setting-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    /* Tablet: Stack preferences cards vertically with moderate spacing */
    .preferences-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .dashboard-header {
        padding: 20px;
    }
    
    .user-welcome h1 {
        font-size: 1.5rem;
    }
    
    .dashboard-nav {
        padding: 0 15px;
    }
    
    .dashboard-content {
        padding: 0 15px;
    }
    
    .pref-card,
    .profile-form,
    .profile-avatar {
        padding: 20px;
    }
    
    /* Mobile: Stack preferences cards vertically with more spacing */
    .preferences-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }
}

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

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}

/* Browse More Section */
.browse-more-section {
    margin-top: 30px;
    padding: 0;
}

.browse-more-card {
    background: var(--off-white);
    border: 2px dashed var(--gray-lighter);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    transition: all 0.2s ease;
}

.browse-more-card:hover {
    border-color: var(--primary-color);
    background: var(--white);
}

.browse-more-card h4 {
    color: var(--dark);
    margin-bottom: 10px;
    font-size: var(--text-lg);
}

.browse-more-card p {
    color: var(--gray);
    margin-bottom: 20px;
    font-size: var(--text-sm);
}

/* Lock Icon SVG */
.lock-svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Expand Icon SVG */
.expand-svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Story Items - Mobile Optimization */
.story-item {
    min-height: 80px; /* Increase minimum height for better touch targets */
}

@media (max-width: 768px) {
    .story-item {
        min-height: 100px; /* Even larger on mobile */
        padding: 20px; /* More padding for better spacing */
    }
    
    .story-header {
        min-height: 60px; /* Ensure header has good height */
        padding: 15px 0; /* Add vertical padding */
    }
    
    .story-title {
        font-size: 1.1rem; /* Slightly larger text */
        line-height: 1.4; /* Better line spacing */
    }
    
    .story-controls {
        gap: 15px; /* More space between controls */
    }
    
    .play-btn {
        width: 48px; /* Larger touch target */
        height: 48px;
        font-size: 1.2rem;
    }
    
    .lock-icon, .processing-icon, .expand-icon {
        margin: 0 5px; /* Add spacing between icons */
    }
}