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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --background-color: #f3f4f6;
    --card-background: #ffffff;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

header .subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Card Styles */
.card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
    display: inline-block;
}

.card h3 {
    font-size: 1.1rem;
    margin-top: 20px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

/* Input Groups */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.role-input-group {
    flex-wrap: wrap;
}

.role-input-group input:first-child {
    flex: 1;
    min-width: 150px;
}

.role-input-group input:nth-child(2) {
    flex: 2;
    min-width: 200px;
}

input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input[type="text"]::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

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

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

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 10px 16px;
}

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

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    padding: 6px 12px;
    font-size: 0.875rem;
}

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

.btn-large {
    padding: 16px 32px;
    font-size: 1.2rem;
    width: 100%;
}

.btn-icon {
    font-size: 1.4em;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Item Lists */
.item-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: var(--background-color);
    border-radius: var(--radius);
    transition: transform 0.2s;
}

.item-list li:hover {
    transform: translateX(4px);
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-name {
    font-weight: 600;
}

.item-description {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.item-actions {
    display: flex;
    gap: 8px;
}

/* Preset Roles */
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.preset-role {
    font-size: 0.9rem;
}

/* Save List Section */
.saved-lists-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.save-list-group {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.saved-lists {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.saved-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: var(--background-color);
    border-radius: var(--radius);
}

.saved-list-info {
    display: flex;
    flex-direction: column;
}

.saved-list-name {
    font-weight: 600;
}

.saved-list-count {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.saved-list-actions {
    display: flex;
    gap: 8px;
}

.btn-load {
    background-color: var(--success-color);
    color: white;
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-load:hover {
    background-color: #059669;
}

/* Assignment Section */
.assignment-section {
    text-align: center;
}

.assignment-results {
    margin-top: 24px;
    text-align: left;
}

.assignment-results h3 {
    text-align: center;
    margin-bottom: 16px;
}

.results-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.results-list li {
    display: flex;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    border-radius: var(--radius);
    color: white;
    animation: slideIn 0.3s ease-out;
}

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

.result-role {
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 140px;
}

.result-arrow {
    margin: 0 16px;
    font-size: 1.2rem;
}

.result-attendee {
    font-size: 1.1rem;
}

.hidden {
    display: none;
}

/* Footer */
footer {
    margin-top: 40px;
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-style: italic;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-color);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: toastIn 0.3s ease-out;
}

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

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

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 16px;
    }

    .input-group {
        flex-direction: column;
    }

    .role-input-group input:first-child,
    .role-input-group input:nth-child(2) {
        min-width: 100%;
    }

    .save-list-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .item-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .item-actions {
        width: 100%;
    }

    .item-actions .btn {
        flex: 1;
    }

    .saved-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .saved-list-actions {
        width: 100%;
    }

    .saved-list-actions .btn {
        flex: 1;
    }

    .results-list li {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .result-role {
        min-width: auto;
    }

    .result-arrow {
        margin: 4px 0;
    }

    .preset-buttons {
        flex-direction: column;
    }

    .preset-role {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }

    header .subtitle {
        font-size: 1rem;
    }

    .card h2 {
        font-size: 1.25rem;
    }

    .btn-large {
        padding: 14px 24px;
        font-size: 1.1rem;
    }
}
