:root {
    --primary-blue: #2196F3;
    --success-green: #4CAF50;
    --warning-yellow: #FFC107;
    --danger-red: #F44336;
    --accent-purple: #9C27B0;
    --background: #f8f9fa;
    --surface: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border: #dee2e6;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    padding-bottom: 80px;
}

.app-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-purple));
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.app-header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.app-main {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.app-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

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

/* Dashboard Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

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

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

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.quick-actions {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.quick-actions h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.action-btn {
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-purple));
    color: white;
    border: none;
    padding: 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.3);
}

.action-btn i {
    font-size: 1.5rem;
}

.recent-activity {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.recent-activity h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.activity-list {
    max-height: 200px;
    overflow-y: auto;
}

.activity-item {
    padding: 0.75rem;
    border-left: 3px solid var(--primary-blue);
    background: var(--background);
    margin-bottom: 0.5rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.activity-item .activity-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.no-activity {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

/* Analysis Styles */
.analysis-container {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.analysis-container h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.analysis-form {
    margin-bottom: 2rem;
}

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

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.input-group select,
.input-group textarea,
.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

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

.primary-btn,
.secondary-btn,
.danger-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.primary-btn:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.secondary-btn {
    background: var(--text-secondary);
    color: white;
}

.secondary-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

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

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

.hidden {
    display: none !important;
}

.analysis-results {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: var(--border-radius);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-card {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.result-card h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.sentiment-indicator {
    text-align: center;
}

.sentiment-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.sentiment-fill {
    height: 100%;
    background: var(--success-green);
    transition: var(--transition);
}

.negative-percentage {
    font-size: 2rem;
    font-weight: 700;
    color: var(--danger-red);
    text-align: center;
    margin-bottom: 1rem;
}

.topic-list,
.recommendation-list {
    list-style: none;
    padding: 0;
}

.topic-list li,
.recommendation-list li {
    padding: 0.5rem;
    background: var(--background);
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius);
    border-left: 3px solid var(--danger-red);
}

.recommendation-list li {
    border-left-color: var(--success-green);
}

.analysis-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Cleanup Styles */
.cleanup-container {
    max-width: 800px;
    margin: 0 auto;
}

.cleanup-container h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.cleanup-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.cleanup-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.cleanup-card h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.cleanup-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.unfollow-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.unfollow-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--background);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}

.unfollow-item .account-info {
    display: flex;
    flex-direction: column;
}

.unfollow-item .account-name {
    font-weight: 500;
}

.unfollow-item .account-reason {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.unfollow-item .unfollow-btn {
    background: var(--danger-red);
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.8rem;
}

.positive-sources {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.source-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--background);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--success-green);
}

.source-name {
    font-weight: 500;
}

.source-category {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--success-green);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
}

.no-suggestions,
.no-history {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.cleanup-history {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    padding: 1rem;
    background: var(--background);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--primary-blue);
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.history-actions {
    font-weight: 500;
}

/* Time Management Styles */
.time-container {
    max-width: 900px;
    margin: 0 auto;
}

.time-container h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.time-limits {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.time-limits h3 {
    margin-bottom: 1rem;
}

.limits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.limit-card {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
}

.platform-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.limit-card h4 {
    margin-bottom: 1rem;
}

.time-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.time-input input {
    width: 80px;
    padding: 0.5rem;
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    text-align: center;
}

.usage-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: var(--primary-blue);
    transition: var(--transition);
}

.usage-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.time-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.detox-scheduler {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.detox-scheduler h3 {
    margin-bottom: 1rem;
}

.detox-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.active-detox {
    text-align: center;
    padding: 2rem;
    background: var(--danger-red);
    color: white;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

.detox-timer {
    font-size: 3rem;
    font-weight: 700;
    margin: 1rem 0;
}

/* Settings Styles */
.settings-container {
    max-width: 600px;
    margin: 0 auto;
}

.settings-container h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.settings-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.settings-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.settings-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: var(--transition);
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-blue);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.setting-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.settings-save {
    text-align: center;
}

/* FAQ Styles */
.faq-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1rem 0;
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    transition: var(--transition);
}

.faq-question:hover {
    color: var(--primary-blue);
}

.faq-icon {
    font-size: 1.2rem;
    font-weight: 300;
    transition: var(--transition);
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 0 1rem 0;
    color: var(--text-secondary);
    line-height: 1.6;
    animation: fadeIn 0.3s ease;
}

.faq-answer[hidden] {
    display: none;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    border-radius: var(--border-radius);
    min-width: 60px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-blue);
    background: rgba(33, 150, 243, 0.1);
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    background: var(--surface);
    margin-top: 2rem;
    border-top: 1px solid var(--border);
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header {
        padding: 1.5rem 1rem;
    }
    
    .app-header h1 {
        font-size: 1.3rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .cleanup-options {
        grid-template-columns: 1fr;
    }
    
    .limits-grid {
        grid-template-columns: 1fr;
    }
    
    .detox-form {
        grid-template-columns: 1fr;
    }
    
    .analysis-actions,
    .time-actions,
    .setting-actions {
        flex-direction: column;
    }
    
    .primary-btn,
    .secondary-btn,
    .danger-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .app-main {
        padding: 0.5rem;
    }
    
    .stat-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .nav-item span {
        display: none;
    }
    
    .nav-item {
        min-width: auto;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-blue);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Success/Error Messages */
.message {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    font-weight: 500;
}

.message.success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success-green);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.message.error {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger-red);
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.message.warning {
    background: rgba(255, 193, 7, 0.1);
    color: var(--warning-yellow);
    border: 1px solid rgba(255, 193, 7, 0.3);
}
