/* Secret Santa Web - Main Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --christmas-red: #c41e3a;
    --christmas-green: #165b33;
    --gold: #f4c430;
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --dark-gray: #212529;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--christmas-green) 0%, #0d3d22 100%);
    color: var(--dark-gray);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--christmas-red) 0%, #a01828 100%);
    color: var(--white);
    padding: 2rem 0;
    box-shadow: 0 4px 6px var(--shadow);
}

header h1 {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header h1::before {
    content: '🎄 ';
}

header h1::after {
    content: ' 🎅';
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 8px 16px var(--shadow);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.card-header {
    border-bottom: 3px solid var(--christmas-red);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

/* Language selector buttons - desktop */
.card-header .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    line-height: 1.5;
    font-size: 1.1rem;
    gap: 0.5rem;
}

.card-header h2 {
    color: var(--christmas-red);
    font-size: 1.8rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--christmas-red) 0%, #a01828 100%);
    color: var(--white);
}

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

.btn-success {
    background: linear-gradient(135deg, var(--christmas-green) 0%, #0d3d22 100%);
    color: var(--white);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(22, 91, 51, 0.3);
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--dark-gray);
    border: 2px solid var(--dark-gray);
}

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

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-gray);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--christmas-red);
}

select.form-control {
    cursor: pointer;
}

/* Assignment Card (Special) */
.assignment-card {
    background: linear-gradient(135deg, #ff6b9d 0%, var(--christmas-red) 100%);
    color: var(--white);
    padding: 3rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 12px 24px rgba(196, 30, 58, 0.4);
    margin: 2rem 0;
}

.assignment-card .receiver-name {
    font-size: 3rem;
    font-weight: 700;
    margin: 1rem 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    padding: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
}

/* Event Details */
.event-details {
    background: var(--light-gray);
    border-left: 4px solid var(--christmas-green);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
}

.event-details .detail-row {
    margin: 0.75rem 0;
    font-size: 1.1rem;
}

.event-details .detail-row strong {
    color: var(--christmas-green);
}

/* Organizer Message */
.organizer-message {
    background: #fffbea;
    border: 2px dashed var(--gold);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
}

.organizer-message h3 {
    color: var(--christmas-red);
    margin-bottom: 1rem;
}

/* Keep Secret Banner */
.keep-secret {
    background: var(--christmas-green);
    color: var(--white);
    padding: 1.5rem;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 8px;
    margin: 2rem 0;
}

.keep-secret::before {
    content: '🤫 ';
}

/* Participant Links */
.participant-link {
    background: var(--light-gray);
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 8px;
    border-left: 4px solid var(--christmas-red);
}

.participant-link .name {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 0.5rem;
}

.participant-link .language-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.participant-link .language-badge.pl {
    background: var(--christmas-red);
    color: var(--white);
}

.participant-link .language-badge.en {
    background: var(--christmas-green);
    color: var(--white);
}

.participant-link .link-box {
    background: var(--white);
    padding: 0.75rem;
    border-radius: 6px;
    margin: 0.5rem 0;
    font-family: monospace;
    font-size: 0.9rem;
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid #ddd;
}

.participant-link .short-link-box {
    background: #e8f5e9;
    border: 2px solid var(--christmas-green);
    font-weight: 600;
    font-size: 1rem;
}

.participant-link .actions {
    margin-top: 0.75rem;
}

.participant-link .actions .btn {
    margin-right: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Footer */
footer {
    background: rgba(0, 0, 0, 0.2);
    color: var(--white);
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    * {
        box-sizing: border-box;
    }

    .container {
        padding: 0.75rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    header {
        padding: 1rem;
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        width: calc(100% + 1.5rem);
    }

    header h1 {
        font-size: 1.2rem;
        padding: 0 0.5rem;
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    header h1 a {
        display: inline-block;
        max-width: 100%;
        overflow-wrap: break-word;
    }

    header h1::before,
    header h1::after {
        font-size: 1rem;
    }

    .card {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 8px;
    }

    .card-header {
        padding-bottom: 0.75rem;
        margin-bottom: 1rem;
    }

    .card-header h2 {
        font-size: 1.3rem;
    }

    .card-header p {
        font-size: 0.9rem;
    }

    /* Homepage specific */
    .card[style*="text-align: center"] {
        margin-top: 1rem !important;
    }

    .card[style*="text-align: center"] p {
        font-size: 1rem !important;
        margin: 1rem 0 !important;
    }

    .card[style*="text-align: center"] h3 {
        font-size: 1.2rem !important;
        margin-bottom: 1rem !important;
    }

    .card[style*="text-align: center"] ol {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
        padding-left: 1.5rem;
        margin-left: 0 !important;
        font-variant-numeric: tabular-nums;
        list-style-position: outside;
    }

    .card[style*="text-align: center"] > div[style*="margin: 3rem"] {
        margin: 1.5rem 0 !important;
    }

    /* Language selector buttons */
    .card-header > div[style*="display: flex"] {
        flex-direction: row !important;
        gap: 0.5rem !important;
    }

    .card-header .btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
        flex: 1;
    }

    /* Assignment Card (Participant View) */
    .assignment-card {
        padding: 1.5rem;
        margin: 1rem 0;
    }

    .assignment-card p {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }

    .assignment-card .receiver-name {
        font-size: 1.8rem;
        padding: 0.75rem;
        margin: 0.5rem 0;
    }

    /* Event Details */
    .event-details {
        padding: 1rem;
        margin: 1rem 0;
    }

    .event-details h3 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem !important;
    }

    .event-details .detail-row {
        font-size: 0.95rem;
        margin: 0.5rem 0;
    }

    /* Organizer Message */
    .organizer-message {
        padding: 1rem;
        margin: 1rem 0;
    }

    .organizer-message h3 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem !important;
    }

    .organizer-message p {
        font-size: 0.95rem !important;
    }

    /* Keep Secret Banner */
    .keep-secret {
        padding: 1rem;
        font-size: 1rem;
        margin: 1rem 0;
    }

    /* Forms - Create Event Page */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-group label {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }

    .form-control {
        padding: 0.6rem;
        font-size: 0.95rem;
    }

    /* Make participant grids stack on mobile */
    .form-group > div[style*="grid-template-columns"],
    div[style*="display: grid"] {
        display: block !important;
        grid-template-columns: 1fr !important;
    }

    .form-group > div[style*="grid-template-columns"] > div,
    div[style*="display: grid"] > div {
        margin-bottom: 0.75rem;
        width: 100% !important;
    }

    .form-group > div[style*="grid-template-columns"] > div:last-child,
    div[style*="display: grid"] > div:last-child {
        margin-bottom: 0;
    }

    /* Participant box header with remove button */
    .form-group div[style*="display: flex"][style*="justify-content: space-between"] {
        display: flex !important;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .form-group div[style*="display: flex"][style*="justify-content: space-between"] button {
        font-size: 0.85rem !important;
        padding: 0.3rem 0.7rem !important;
        white-space: nowrap;
    }

    /* Exclusion boxes - more compact on mobile */
    #exclusionsList .form-group {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }

    #exclusionsList .form-group label {
        font-size: 0.85rem !important;
        margin-bottom: 0.3rem !important;
    }

    /* Hide the emoji separator in exclusions on mobile */
    #exclusionsList div[style*="text-align: center"][style*="font-size: 1.5rem"] {
        display: none !important;
    }

    /* Checkbox label more compact */
    #exclusionsList label[style*="cursor: pointer"] {
        font-size: 0.85rem !important;
    }

    #exclusionsList label[style*="cursor: pointer"] span {
        line-height: 1.3 !important;
    }

    #exclusionsList input[type="checkbox"] {
        width: 16px !important;
        height: 16px !important;
        margin-right: 0.4rem !important;
    }

    /* Exclusion margin after grid */
    #exclusionsList div[style*="margin-top: 1rem"] {
        margin-top: 0.5rem !important;
    }

    /* Section headings in forms */
    form h3 {
        font-size: 1.2rem !important;
        margin: 1.5rem 0 0.75rem !important;
    }

    form p {
        font-size: 0.9rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* Organizer Panel - Participant Links */
    .participant-link {
        padding: 1rem;
        margin: 0.75rem 0;
        max-width: 100%;
        overflow: hidden;
    }

    .participant-link .name {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .participant-link .language-badge {
        padding: 0.2rem 0.6rem;
        font-size: 0.85rem;
    }

    .participant-link .link-box {
        padding: 0.6rem;
        font-size: 0.8rem;
        margin: 0.5rem 0;
        word-break: break-all;
        max-width: 100%;
        overflow-x: auto;
        white-space: normal;
    }

    .participant-link .actions {
        margin-top: 0.5rem;
    }

    .participant-link .actions .btn {
        margin-right: 0;
        margin-bottom: 0.5rem;
        width: 100%;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    /* Organizer Panel - Warning box */
    div[style*="background: #fff3cd"] {
        padding: 1rem !important;
        margin: 1rem 0 !important;
    }

    div[style*="background: #fff3cd"] h3 {
        font-size: 1.1rem !important;
        margin-bottom: 0.75rem !important;
    }

    div[style*="background: #fff3cd"] ol {
        margin-left: 1rem !important;
        line-height: 1.6 !important;
        font-size: 0.9rem !important;
    }

    /* Organizer Panel - Save page box */
    div[style*="background: var(--light-gray)"] {
        padding: 1rem !important;
        margin-top: 2rem !important;
    }

    div[style*="background: var(--light-gray)"] h4 {
        font-size: 1.1rem !important;
        margin-bottom: 0.75rem !important;
    }

    div[style*="background: var(--light-gray)"] p {
        font-size: 0.9rem !important;
    }

    /* Alert Messages */
    .alert {
        padding: 0.75rem 1rem;
        margin: 0.75rem 0;
        font-size: 0.9rem;
    }

    /* Primary CTA buttons */
    .btn-primary[style*="font-size: 1.3rem"],
    .btn-primary[style*="font-size: 1.2rem"] {
        font-size: 1rem !important;
        padding: 0.75rem 2rem !important;
    }

    /* Regular buttons */
    .btn:not(.card-header .btn):not(.participant-link .btn) {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
        font-size: 0.95rem;
        padding: 0.65rem 1.5rem;
    }

    /* Assignment view - specific styles */
    .card[style*="max-width: 800px"] {
        max-width: 100% !important;
        margin: 1rem auto !important;
    }

    .card[style*="max-width: 800px"] p[style*="font-size: 1.5rem"] {
        font-size: 1.2rem !important;
    }

    /* Footer */
    footer {
        padding: 1rem;
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        margin-top: 2rem;
        width: calc(100% + 1.5rem);
        font-size: 0.8rem;
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    footer p {
        margin: 0.3rem 0;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    footer small {
        font-size: 0.75rem;
    }
}

/* Loading Spinner */
.spinner {
    border: 4px solid var(--light-gray);
    border-top: 4px solid var(--christmas-red);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Christmas Tree Animation (Optional) */
@keyframes sway {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(2deg); }
    75% { transform: rotate(-2deg); }
}

.christmas-tree {
    display: inline-block;
    animation: sway 3s ease-in-out infinite;
}
