:root {
    --primary: #404040;
    --primary-dark: #2a2a2a;
    --primary-light: #5a5a5a;
    --secondary: #404040;
    --success: #4a4a4a;
    --danger: #3a3a3a;
    --dark: #1a1a1a;
    --gray: #888888;
    --light-gray: #e5e5e5;
    --border: #404040;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #f5f5f5;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
}

.language-toggle {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 10;
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.lang-btn {
    background: transparent;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flag-icon {
    width: 28px;
    height: 20px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.lang-btn:hover {
    transform: scale(1.1);
}

.lang-btn.active {
    border-color: #404040;
    background: rgba(64, 64, 64, 0.1);
}

.lang-btn.active .flag-icon {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    color: white;
    padding: 16px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: none;
    pointer-events: none;
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 2px;
    font-weight: 700;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

header h2 {
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.9;
    letter-spacing: 0.01em;
    position: relative;
    z-index: 1;
}

.header-logo {
    position: absolute;
    top: 12px;
    left: 24px;
    height: 40px;
    width: auto;
    z-index: 10;
}

main {
    padding: 20px 24px;
}

.event-info-section {
    background: white;
    border: 2px solid #404040;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.event-info-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 16px;
}

.event-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
}

.field-group input {
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
    font-family: inherit;
}

.field-group input:focus {
    outline: none;
    border-color: #404040;
    box-shadow: 0 0 0 3px rgba(64, 64, 64, 0.1);
}

.info-box {
    background: #e8e8e8;
    border-left: 4px solid #404040;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 2px var(--shadow);
}

.info-box p {
    color: var(--dark);
    font-size: 0.9rem;
    font-weight: 500;
}

.info-box strong {
    color: var(--primary-dark);
    font-weight: 700;
}

#groups-container {
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.group-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px var(--shadow);
    height: fit-content;
}

.group-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 8px var(--shadow-lg);
    transform: translateY(-2px);
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--light-gray);
}

.group-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: -0.01em;
}

.delete-group-btn {
    background: white;
    color: var(--danger);
    border: 1.5px solid var(--danger);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}

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

.names-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.name-input-wrapper {
    position: relative;
}

.name-input {
    width: 100%;
    padding: 8px 36px 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: white;
    font-family: inherit;
}

.name-input:focus {
    outline: none;
    border-color: #404040;
    box-shadow: 0 0 0 3px rgba(64, 64, 64, 0.1);
}

.name-input::placeholder {
    color: var(--gray);
    font-size: 0.85rem;
}

.remove-name-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--danger);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: all 0.2s;
    font-weight: 600;
}

.remove-name-btn:hover {
    background: #dc2626;
}

.add-name-btn {
    background: white;
    color: var(--success);
    border: 1.5px solid var(--success);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    width: 100%;
}

.add-name-btn:hover:not(:disabled) {
    background: var(--success);
    color: white;
}

.add-name-btn:disabled {
    border-color: var(--gray);
    color: var(--gray);
    cursor: not-allowed;
    opacity: 0.5;
}

.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px -1px var(--shadow);
    letter-spacing: 0.01em;
}

.btn span {
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #404040 0%, #2a2a2a 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #4a4a4a 0%, #3a3a3a 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.btn:disabled {
    background: var(--gray);
    cursor: not-allowed;
    opacity: 0.5;
    transform: none !important;
}

.btn:active:not(:disabled) {
    transform: translateY(-1px);
}

.message {
    margin-top: 24px;
    padding: 18px 24px;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 1.05rem;
    display: none;
    animation: slideIn 0.3s ease;
}

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

.message.show {
    display: block;
}

.message.success {
    background: #e8e8e8;
    color: #2a2a2a;
    border: 2px solid #5a5a5a;
}

.message.error {
    background: #d8d8d8;
    color: #1a1a1a;
    border: 2px solid #4a4a4a;
}

.message.info {
    background: #e8e8e8;
    color: #2a2a2a;
    border: 2px solid #5a5a5a;
}

footer {
    background: var(--light-gray);
    padding: 32px 40px;
    text-align: center;
    color: var(--gray);
    font-size: 0.95rem;
}

.loading {
    pointer-events: none;
    opacity: 0.6;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.loading-overlay.show {
    display: flex;
}

.loading-content {
    background: white;
    padding: 40px 60px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s ease;
}

.loading-content .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e5e5;
    border-top-color: #404040;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

.loading-content h3 {
    font-size: 1.3rem;
    color: var(--dark);
    margin: 0;
    font-weight: 700;
}

.loading-content p {
    font-size: 0.95rem;
    color: var(--gray);
    margin: 8px 0 0 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    header {
        padding: 14px 16px;
    }

    header h1 {
        font-size: 1.3rem;
    }

    header h2 {
        font-size: 0.85rem;
    }

    main {
        padding: 16px;
    }
    
    .event-info-section {
        padding: 16px;
    }
    
    .event-fields {
        grid-template-columns: 1fr;
    }
    
    #groups-container {
        grid-template-columns: 1fr;
    }

    .group-card {
        padding: 12px;
    }

    .actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .loading-content {
        padding: 32px 40px;
        margin: 0 20px;
    }
}

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

    header h2 {
        font-size: 1rem;
    }

    .group-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .delete-group-btn {
        width: 100%;
    }
}
