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

:root {
    --primary-color: #D4AC0D;
    --secondary-color: #8D8741;
    --accent-color: #659DBD;
    --neutral-color: #DAAD86;
    --light-color: #FBEEC1;
    --text-dark: #2c3e50;
    --text-light: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary-color: #F1C40F;
    --secondary-color: #A5A855;
    --accent-color: #7FB3D3;
    --neutral-color: #E8C4A0;
    --light-color: #2c3e50;
    --text-dark: #ffffff;
    --text-light: #2c3e50;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--light-color) 0%, var(--neutral-color) 100%);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.6;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-light);
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header__title {
    font-size: 1.8rem;
    font-weight: 700;
}

.header__actions {
    display: flex;
    gap: 0.5rem;
}

/* Main Layout */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 140px);
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen--active {
    display: block;
}

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

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

.screen__title {
    font-size: 2rem;
    color: var(--text-dark);
    font-weight: 600;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn--primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-light);
}

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

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

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

.btn--back {
    background: transparent;
    color: var(--text-dark);
    border: 2px solid var(--accent-color);
}

.btn--back:hover {
    background: var(--accent-color);
    color: var(--text-light);
}

.btn--small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn--vote {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.btn--vote.voted {
    background: var(--primary-color);
    color: var(--text-light);
}

/* Groups Grid */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.group-card {
    background: var(--text-light);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.group-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    border-color: var(--accent-color);
}

.group-card__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.group-card__avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-light);
}

.group-card__info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    color: var(--text-dark);
}

.group-card__info p {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.group-card__stats {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.group-card__stat {
    text-align: center;
}

.group-card__stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.group-card__stat-label {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 2rem;
    overflow-x: auto;
}

.tab {
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    color: var(--secondary-color);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.tab--active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

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

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content--active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Tasks List */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.task-card {
    background: var(--text-light);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-left: 4px solid var(--accent-color);
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.task-card--high-priority {
    border-left-color: var(--primary-color);
}

.task-card--completed {
    opacity: 0.7;
    border-left-color: #27ae60;
}

.task-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.task-card__title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.task-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.task-card__category {
    background: var(--light-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.task-card__description {
    color: var(--text-dark);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.task-card__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.task-card__votes {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.task-card__vote-count {
    font-weight: 600;
    color: var(--primary-color);
}

.task-card__buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Forms */
.form {
    max-width: 600px;
    margin: 0 auto;
}

.form__group {
    margin-bottom: 1.5rem;
}

.form__label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form__input,
.form__select,
.form__textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--text-light);
    color: var(--text-dark);
}

.form__input:focus,
.form__select:focus,
.form__textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(101, 157, 189, 0.1);
}

.form__textarea {
    resize: vertical;
    min-height: 100px;
}

.form__actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal--active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal__content {
    background: var(--text-light);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal__content--large {
    max-width: 700px;
}

.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.modal__header h3 {
    color: var(--text-dark);
    font-size: 1.5rem;
}

.modal__close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--secondary-color);
    transition: var(--transition);
}

.modal__close:hover {
    color: var(--text-dark);
}

/* Comments */
.comments {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.comment {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.comment:last-child {
    border-bottom: none;
}

.comment__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment__author {
    font-weight: 600;
    color: var(--primary-color);
}

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

.comment__text {
    color: var(--text-dark);
    line-height: 1.5;
}

.comment-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.comment-form .form__input {
    flex: 1;
    margin-bottom: 0;
}

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

.stat-card {
    background: var(--text-light);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card h3 {
    color: var(--secondary-color);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

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

.dashboard__chart {
    background: var(--text-light);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

/* Footer */
.footer {
    background: var(--secondary-color);
    color: var(--text-light);
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header__container {
        padding: 0 1rem;
    }
    
    .header__title {
        font-size: 1.5rem;
    }
    
    .main {
        padding: 1rem;
    }
    
    .screen__header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .screen__title {
        font-size: 1.5rem;
    }
    
    .groups-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        justify-content: flex-start;
    }
    
    .tab {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .task-card__header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .task-card__actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .task-card__buttons {
        justify-content: center;
    }
    
    .form__actions {
        flex-direction: column;
    }
    
    .modal__content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .comment-form {
        flex-direction: column;
    }
    
    .dashboard__stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header__title {
        font-size: 1.2rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .task-card {
        padding: 1rem;
    }
    
    .task-card__title {
        font-size: 1.1rem;
    }
    
    .modal__content {
        padding: 1rem;
    }
}

/* Loading and Empty States */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-color);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-color);
}

.empty-state__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state__title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.empty-state__description {
    margin-bottom: 1.5rem;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.animate-slide-in {
    animation: slideIn 0.3s ease;
}

.animate-pulse {
    animation: pulse 0.3s ease;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for better accessibility */
.btn:focus,
.form__input:focus,
.form__select:focus,
.form__textarea:focus,
.tab:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .task-card,
    .group-card {
        border: 2px solid var(--text-dark);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
