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

:root {
    /* Light Theme Colors */
    --primary-color: #6366f1; /* Indigo */
    --primary-hover: #4f46e5; /* Darker Indigo */
    --secondary-color: #64748b; /* Slate */
    --success-color: #10b981; /* Emerald Green */
    --error-color: #ef4444; /* Red */
    --warning-color: #f59e0b; /* Amber */
    
    --bg-primary: #fdfdfe; /* Off-white */
    --bg-secondary: #f0f4f8; /* Light gray-blue */
    --bg-card: #ffffff; /* Pure white for cards */
    --text-primary: #1a202c; /* Dark text */
    --text-secondary: #4a5568; /* Slightly darker secondary text */
    --text-muted: #718096; /* Gray muted text */
    --border-color: #e2e8f0; /* Light gray border */
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.12), 0 3px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.18), 0 8px 16px rgba(0, 0, 0, 0.12);
    
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1.25rem; 

    /* Helper for RGB color from var for alpha channel usage */
    --text-primary-rgb: 26, 32, 44; /* RGB equivalent of #1a202c */
}

[data-theme="dark"] {
    --bg-primary: #1a202c; /* Dark blue-gray */
    --bg-secondary: #2d3748; /* Darker gray-blue */
    --bg-card: #28303d; /* Dark card background */
    --text-primary: #e2e8f0; /* Light text */
    --text-secondary: #a0aec0; /* Lighter secondary text */
    --text-muted: #718096; /* Gray muted text */
    --border-color: #4a5568; /* Darker border */
    
    /* Dark mode shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.3), 0 3px 6px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.4), 0 8px 16px rgba(0, 0, 0, 0.3);

    /* Helper for RGB color from var for alpha channel usage */
    --text-primary-rgb: 226, 232, 240; /* RGB equivalent of #e2e8f0 */
}


html {
    font-size: 70%; /* Base font size reduction for overall smaller feel */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    color: var(--text-primary);
    line-height: 1.7; 
    min-height: 100vh;
    display: flex; 
    flex-direction: column;
}

/* --- GLOBAL HEADER STYLES --- */
.global-header {
    background: var(--bg-card); 
    box-shadow: var(--shadow-sm); 
    padding: 0.75rem 0; 
    border-bottom: 1px solid var(--border-color); 
    position: sticky; 
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000; 
    display: flex;
    justify-content: center; 
}

.global-header .header-content {
    max-width: 1200px; 
    width: 100%; 
    padding: 0 10%; 
    display: flex;
    justify-content: space-between; 
    align-items: center;
}

.global-header .logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary-color); 
    font-weight: 700;
    font-size: 1.9rem; 
    letter-spacing: -0.04em; 
    transition: color 0.2s ease;
}

.global-header .logo a:hover {
    color: var(--primary-hover); 
}

.global-header .logo-img {
    display: none; 
}

.global-header .main-nav {
    display: flex;
    align-items: center;
}

.global-header .nav-list {
    list-style: none;
    display: flex;
    gap: 2.2rem; 
}

.global-header .nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0; 
    transition: color 0.2s ease, transform 0.2s ease; 
    position: relative; 
}

.global-header .nav-link:hover {
    color: var(--primary-color);
    transform: translateY(-2px); 
}

.global-header .nav-link.current-page {
    color: var(--primary-color);
    font-weight: 600;
}

.global-header .nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px; 
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-color);
    transition: width 0.3s ease-in-out;
}

.global-header .nav-link:hover::after,
.global-header .nav-link.current-page::after {
    width: 100%;
}

.global-header .nav-toggle {
    display: none; 
    background: none;
    border: none;
    font-size: 2rem; 
    cursor: pointer;
    color: var(--text-primary);
}


/* Theme Toggle (adjusted positioning relative to new header) */
.theme-toggle {
    position: fixed;
    top: 1rem; 
    right: 1.5rem; 
    background: var(--bg-card);
    border: 1px solid var(--border-color); 
    border-radius: 50%;
    width: 2.5rem; 
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem; 
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm); 
    z-index: 1001; 
}



/* Main container for page content */
.container {
    width: 100%; 
    max-width: 100%; 
    margin: 0 auto; 
    padding: 1.75rem 10%; 
    
    flex: 1; 
    display: flex;
    flex-direction: column;
    gap: 2.5rem; 
}

/* Original Header (now a sub-header/intro section) */
.header {
    text-align: center;
    margin-bottom: 0; 
    padding: 1.5rem 0; 
}

.title {
    font-size: 2.5rem; 
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.8rem; 
    text-shadow: none; 
    letter-spacing: -0.02em; 
}

.subtitle {
    font-size: 1.1rem; 
    color: var(--text-secondary);
    font-weight: 500;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2.5rem; 
}

.generator-card {
    padding: 2.5rem; 
    transition: transform 0.3s ease, box-shadow 0.3s ease; 
}


/* Form Styles */
.generator-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; 
    margin-bottom: 2rem;
}

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

.form-group-flex {
    display: flex;
    gap: 1.25rem; 
    flex-wrap: wrap; 
    justify-content: space-between;
}

.form-group-flex .form-group {
    flex: 1; 
    min-width: 200px; 
}


.form-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.05rem; 
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.form-textarea,
.form-input {
    padding: 1rem; 
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: 1rem; 
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.25s ease; 
    resize: vertical;
}

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

.form-textarea {
    min-height: 180px; 
    line-height: 1.6; 
}

/* Name Counter */
.name-counter {
    font-size: 0.85rem; 
    color: var(--text-muted);
    margin-top: 0.4rem; 
    text-align: right;
    padding-right: 0.5rem;
}


/* Button Styles */
.button-group {
    display: flex;
    gap: 1.25rem; 
    flex-wrap: wrap;
    justify-content: center; 
    margin-top: 1.5rem; 
}

.btn {
    padding: 0.9rem 1.8rem; 
    border: none;
    border-radius: var(--border-radius-lg); 
    font-size: 1.05rem; 
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease; 
    display: inline-flex;
    align-items: center;
    gap: 0.6rem; 
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    box-shadow: var(--shadow-md); 
}



.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm); 
}



.copy-btn {
    padding: 0.6rem 1rem; 
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 0.9rem; 
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem; 
}



/* Error Message */
.error-message {
    background: #fee2e2; 
    border: 1px solid #fca5a5; 
    color: var(--error-color);
    padding: 1rem; 
    border-radius: var(--border-radius-md);
    font-weight: 500;
    text-align: center; 
}

[data-theme="dark"] .error-message {
    background: #450a0a;
    border-color: #7f1d1d;
}

/* Instructions */
.instructions {

    padding: 2.25rem; 
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}



.instructions-title {
    font-size: 1.4rem; 
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem; 
    text-align: center; 
}

.instructions-list {
    list-style: none;
    counter-reset: step-counter;
    margin-bottom: 1.5rem; 
    padding-left: 0; 
}

.instructions-list li {
    counter-increment: step-counter;
    margin-bottom: 0.8rem; 
    padding-left: 2.5rem; 
    position: relative;
    color: var(--text-secondary);
    font-size: 1.05rem; 
}

.instructions-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: var(--primary-color);
    color: white;
    width: 1.8rem; 
    height: 1.8rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem; 
    font-weight: 700;
    box-shadow: var(--shadow-sm); 
}

.instructions-note {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.95rem; 
    text-align: center; 
    margin-top: 1.5rem; 
}

/* Results Section */
.results-section {

    padding: 2.5rem; 

    scroll-margin-top: 2rem; 
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.results-title {
    font-size: 2rem; 
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2rem; 
    text-align: center;
    text-shadow: none; 
}
.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 1.75rem; 
}

.team-card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.75rem; 
 
    transition: all 0.3s ease; 
    display: flex;
    flex-direction: column;
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem; 
    padding-bottom: 1rem; 
    border-bottom: 2px solid var(--border-color);
}

.team-title {
    font-size: 1.35rem; 
    font-weight: 600;
    color: var(--primary-color);
}

.team-members {
    list-style: none;
    margin-bottom: 1.25rem; 
    flex-grow: 1; 
}

.member-item {
    padding: 0.6rem 0; 
    color: var(--text-primary);
    border-bottom: 1px dashed var(--border-color); 
    font-weight: 500;
}

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

.team-count {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem; 
    font-weight: 500;
    background: var(--bg-secondary);
    padding: 0.6rem 0.8rem; 
    border-radius: var(--border-radius-sm);
    margin-top: auto; 
}

/* Bulk Actions */
.bulk-actions {
    display: flex;
    gap: 1.25rem; 
    margin-bottom: 1.75rem; 
    flex-wrap: wrap;
    justify-content: center;
}


/* Footer */
.footer {
    text-align: center;
    padding: 2.5rem 0 1.5rem; 
    color: var(--text-muted);
    font-size: 0.9rem; 
    border-top: 1px solid var(--border-color); 
    margin-top: 3rem; 
}

/* Footer Links Styling */
.footer-links {
    margin-top: 0.8rem;
    font-size: 0.85rem;
    display: flex; /* Make links inline */
    justify-content: center; /* Center them */
    gap: 0.5rem; /* Space between links and separators */
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* Toast Messages */
.toast {
    position: fixed;
    bottom: 2rem; 
    right: 2rem; 
    background: var(--success-color);
    color: white;
    padding: 1.1rem 1.6rem; 
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    font-weight: 500;
    min-width: 220px; 
    text-align: center;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* Dark Mode Toggle */
.theme-toggle {
    position: fixed;
    top: 1rem; 
    right: 1.5rem; 
    background: var(--bg-card);
    border: 1px solid var(--border-color); 
    border-radius: 50%;
    width: 2.5rem; 
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem; 
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm); 
    z-index: 1001; 
}

.theme-toggle:hover {
    transform: scale(1.08); 
    box-shadow: var(--shadow-md); 
}

/* --- NEW DICE ANIMATION STYLES (already good) --- */
.dice-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(var(--text-primary-rgb), 0.8); /* Dark semi-transparent overlay */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999; 
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.dice-animation-overlay.active {
    opacity: 1;
    visibility: visible;
}

.dice-icon {
    font-size: 8rem; 
    animation: shakeRoll 1s infinite cubic-bezier(.36,.07,.19,.97) both; 
    transform-origin: 50% 50%;
    color: var(--bg-card); 
}

.dice-message {
    font-size: 1.5rem;
    color: white;
    margin-top: 1.5rem;
    font-weight: 600;
}

@keyframes shakeRoll {
    10%, 90% { transform: translate3d(-1px, 0, 0) rotate(-1deg); }
    20%, 80% { transform: translate3d(2px, 0, 0) rotate(2deg); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0) rotate(-4deg); }
    40%, 60% { transform: translate3d(4px, 0, 0) rotate(4deg); }
    100% { transform: translate3d(0, 0, 0) rotate(0deg); }
}
/* Helper for RGB color from var */
:root {
    --text-primary-rgb: 26, 32, 44; /* RGB equivalent of #1a202c */
}
[data-theme="dark"] {
    --text-primary-rgb: 226, 232, 240; /* RGB equivalent of #e2e8f0 */
}


/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem 1rem; 
        gap: 2rem; 
        width: calc(100% - 2rem); 
    }
    
    /* Global Header Responsive */
    .global-header {
        padding: 0.5rem 0; 
    }

    .global-header .header-content {
        padding: 0 1rem; 
        flex-wrap: wrap; 
        justify-content: center; 
        text-align: center;
    }

    .global-header .logo {
        width: 100%; 
        margin-bottom: 0.5rem; 
    }

    .global-header .logo a {
        justify-content: center; 
    }

    .global-header .main-nav {
        display: none; 
        flex-direction: column;
        position: absolute;
        top: 100%; 
        left: 0;
        width: 100%;
        background: var(--bg-card);
        box-shadow: var(--shadow-md);
        border-top: 1px solid var(--border-color);
    }
    
    .global-header .nav-list {
        flex-direction: column;
        padding: 1rem 0;
    }

    .global-header .nav-list li {
        width: 100%;
        text-align: center;
    }

    .global-header .nav-link {
        display: block;
        padding: 0.8rem 1rem;
    }

    .global-header .nav-link::after { 
        display: none;
    }

    .global-header .nav-toggle {
        display: block; 
        position: absolute; 
        right: 1rem;
        top: 0.5rem;
    }

    .global-header .main-nav.active {
        display: flex;
    }


    .header {
        padding: 1.25rem 0;
    }
    
    .title {
        font-size: 2.2rem; 
    }
    
    .subtitle {
        font-size: 1rem; 
    }
    
    .generator-card,
    .results-section,
    .instructions {
        padding: 1.8rem; 
        border-radius: var(--border-radius-lg);
    }
    
    .teams-grid {
        grid-template-columns: 1fr; 
        gap: 1.5rem; 
    }
    
    .team-card {
        padding: 1.25rem; 
    }
    
    .button-group {
        flex-direction: column;
        gap: 0.8rem; 
    }








    
    
    .btn {
        width: 100%;
        justify-content: center;
        padding: 0.8rem 1rem; 
        font-size: 1rem; 
    }
    
    .form-input {
        max-width: 100%;
    }
    
    .team-header {
        flex-direction: column;
        gap: 0.6rem; 
        align-items: stretch;
    }
    
    .copy-btn {
        align-self: flex-end;
    }
    
    .toast {
        bottom: 1rem; 
        right: 0.75rem; 
        left: 0.75rem; 
        padding: 0.9rem; 
        min-width: unset;
    }
    
    .toast.show {
        transform: translateY(0);
    }
    
    .theme-toggle {
        top: 0.8rem; 
        right: 0.8rem; 
        width: 2.4rem; 
        height: 2.4rem;
        font-size: 0.95rem; 
    }

    .form-group-flex {
        flex-direction: column;
    }
    .form-group-flex .form-group {
        width: 100%;
        min-width: unset;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

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

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

/* Loading State */
.btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

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






.language-switcher {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem;

}

.lang-link {
    text-decoration: none;
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    border-radius: var(--border-radius-sm);
    transition: background 0.3s, color 0.3s;
    background-color: transparent;
    border: 1px solid transparent;
}

.lang-link:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.lang-active {
    font-weight: bold;
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: #fff;
}

@media (max-width: 480px) {
    .lang-link {
        font-size: 0.85rem;
        padding: 0.3rem 0.6rem;
    }
}
