/* CSS Variables for theming */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --background-color: #0f172a;
    --surface-color: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #475569;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
    background: linear-gradient(135deg, var(--surface-color) 0%, var(--background-color) 100%);
    border-bottom: 1px solid var(--border-color);
}

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

.logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Main Content */
main {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

section {
    margin-bottom: 2.5rem;
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Category Selection */
.category-section {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.category-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--surface-light);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

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

.category-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.category-icon {
    font-size: 1.75rem;
}

.category-name {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
}

/* Generate Button */
.generate-section {
    text-align: center;
}

.generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    filter: brightness(1.1);
}

.generate-btn:active {
    transform: translateY(0);
}

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

/* Dilemma Display */
.dilemma-section {
    opacity: 1;
    transition: var(--transition);
}

.dilemma-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.5s ease;
}

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

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

.dilemma-category {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dilemma-difficulty {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: var(--surface-light);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
}

.dilemma-difficulty.easy {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-color);
}

.dilemma-difficulty.medium {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.dilemma-difficulty.hard {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-color);
}

.dilemma-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.dilemma-scenario {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.7;
}

/* Perspectives Section */
.perspectives-section,
.prompts-section {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.perspectives-section h4,
.prompts-section h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.perspectives-grid {
    display: grid;
    gap: 1rem;
}

.perspective-card {
    background: var(--surface-light);
    border-radius: var(--radius-md);
    padding: 1rem;
    border-left: 4px solid var(--primary-color);
}

.perspective-card:nth-child(2) {
    border-left-color: var(--secondary-color);
}

.perspective-card:nth-child(3) {
    border-left-color: var(--accent-color);
}

.perspective-card:nth-child(4) {
    border-left-color: var(--success-color);
}

.perspective-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.perspective-content {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Prompts List */
.prompts-list {
    list-style: none;
}

.prompts-list li {
    position: relative;
    padding: 0.75rem 0 0.75rem 1.5rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.prompts-list li:last-child {
    border-bottom: none;
}

.prompts-list li::before {
    content: "?";
    position: absolute;
    left: 0;
    top: 0.75rem;
    width: 1rem;
    height: 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.action-btn:hover {
    background: var(--surface-light);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

/* Saved Dilemmas */
.saved-section {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.saved-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.saved-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--surface-light);
    border-radius: var(--radius-md);
    gap: 1rem;
}

.saved-item-content {
    flex: 1;
    cursor: pointer;
}

.saved-item-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.saved-item-category {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.saved-item-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.saved-item-delete:hover {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

.empty-message {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

/* Submit Section */
.submit-section {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.submit-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.submit-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.75rem 1rem;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 0.5rem;
}

.submit-btn:hover {
    background: var(--primary-hover);
}

/* User Submissions */
.user-submissions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.user-submissions h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.submissions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.submission-item {
    background: var(--surface-light);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.submission-item:hover {
    border-color: var(--primary-color);
}

.submission-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.submission-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Footer */
footer {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
}

.footer-content {
    max-width: 900px;
    margin: 0 auto;
}

.footer-links {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color);
}

.separator {
    margin: 0 0.75rem;
    color: var(--text-muted);
}

.powered-by {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.powered-by a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.powered-by a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

.modal-content ul {
    color: var(--text-secondary);
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.modal-content li {
    margin-bottom: 0.5rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface-color);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success-color);
}

.toast.error {
    border-color: var(--error-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.75rem;
    }

    .tagline {
        font-size: 0.95rem;
    }

    .category-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .category-btn {
        padding: 0.75rem;
    }

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

    .category-name {
        font-size: 0.75rem;
    }

    .generate-btn {
        padding: 0.875rem 2rem;
        font-size: 1.1rem;
    }

    .dilemma-card {
        padding: 1.5rem;
    }

    .dilemma-title {
        font-size: 1.25rem;
    }

    .dilemma-scenario {
        font-size: 1rem;
    }

    .action-buttons {
        justify-content: center;
    }

    main {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 2rem 1rem 1.5rem;
    }

    .logo-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.85rem;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .generate-btn {
        width: 100%;
        justify-content: center;
    }

    .action-btn {
        flex: 1;
        justify-content: center;
        min-width: 90px;
    }

    .dilemma-header {
        flex-direction: column;
        align-items: flex-start;
    }

    section h2 {
        font-size: 1.25rem;
    }
}

/* Print Styles */
@media print {
    .generate-section,
    .action-buttons,
    .submit-section,
    footer,
    .category-section {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .dilemma-card,
    .perspectives-section,
    .prompts-section {
        background: white;
        border: 1px solid #ccc;
    }
}
