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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.snowflake {
    position: absolute;
    top: -10px;
    color: white;
    font-size: 1.5em;
    opacity: 0.8;
    animation: fall linear infinite;
}

.snowflake:nth-child(odd) {
    animation-duration: 10s;
}

.snowflake:nth-child(even) {
    animation-duration: 15s;
}

@keyframes fall {
    0% {
        top: -10%;
        transform: translateX(0) rotate(0deg);
    }
    100% {
        top: 110%;
        transform: translateX(100px) rotate(360deg);
    }
}

.snowflake:nth-child(1) { left: 10%; animation-delay: 0s; }
.snowflake:nth-child(2) { left: 20%; animation-delay: 2s; }
.snowflake:nth-child(3) { left: 30%; animation-delay: 4s; }
.snowflake:nth-child(4) { left: 40%; animation-delay: 1s; }
.snowflake:nth-child(5) { left: 50%; animation-delay: 3s; }
.snowflake:nth-child(6) { left: 60%; animation-delay: 5s; }
.snowflake:nth-child(7) { left: 70%; animation-delay: 2.5s; }
.snowflake:nth-child(8) { left: 80%; animation-delay: 4.5s; }
.snowflake:nth-child(9) { left: 90%; animation-delay: 1.5s; }
.snowflake:nth-child(10) { left: 95%; animation-delay: 3.5s; }
.snowflake:nth-child(11) { left: 5%; animation-delay: 0.5s; }
.snowflake:nth-child(12) { left: 15%; animation-delay: 2.8s; }
.snowflake:nth-child(13) { left: 25%; animation-delay: 4.2s; }
.snowflake:nth-child(14) { left: 35%; animation-delay: 1.8s; }
.snowflake:nth-child(15) { left: 45%; animation-delay: 3.2s; }
.snowflake:nth-child(16) { left: 55%; animation-delay: 5.2s; }
.snowflake:nth-child(17) { left: 65%; animation-delay: 2.2s; }
.snowflake:nth-child(18) { left: 75%; animation-delay: 4.8s; }
.snowflake:nth-child(19) { left: 85%; animation-delay: 1.2s; }
.snowflake:nth-child(20) { left: 92%; animation-delay: 3.8s; }

.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
}

h1 {
    text-align: center;
    color: #d42f2f;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: bold;
    color: #2a5298;
    font-size: 1.1em;
}

.form-group textarea,
.form-group input[type="number"] {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group textarea:focus,
.form-group input[type="number"]:focus {
    outline: none;
    border-color: #d42f2f;
}

.form-group small {
    color: #666;
    font-style: italic;
}

.btn {
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #d42f2f, #a52222);
    color: white;
    box-shadow: 0 4px 15px rgba(212, 47, 47, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 47, 47, 0.6);
}

.btn-danger {
    background: linear-gradient(135deg, #666, #444);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #888, #666);
}

.btn-copy {
    padding: 8px 15px;
    background: #2a5298;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

.btn-copy:hover {
    background: #1e3c72;
}

.success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 2px solid #28a745;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.success h2 {
    color: #155724;
    margin-bottom: 15px;
}

.success p {
    color: #155724;
    font-size: 1.1em;
}

.expiry-info {
    background: rgba(255, 193, 7, 0.2);
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 10px;
    margin-top: 15px;
    color: #856404;
}

.links-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.link-box {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 15px;
}

.link-box strong {
    display: block;
    margin-bottom: 10px;
    color: #2a5298;
    font-size: 1.1em;
}

.link-url {
    display: flex;
    gap: 10px;
}

.link-url input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 0.9em;
    font-family: monospace;
    background: white;
}

.error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border: 2px solid #dc3545;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    color: #721c24;
    font-weight: bold;
    text-align: center;
}

.reveal-box {
    text-align: center;
    padding: 20px;
}

.gift-container {
    margin: 40px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gift {
    font-size: 8em;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.intro {
    font-size: 1.5em;
    color: #2a5298;
    margin-bottom: 20px;
    font-weight: 500;
}

.receiver-name {
    font-size: 3em;
    font-weight: bold;
    color: #d42f2f;
    padding: 30px;
    background: linear-gradient(135deg, #fff5f5, #ffe6e6);
    border: 3px solid #d42f2f;
    border-radius: 20px;
    margin: 20px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(212, 47, 47, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(212, 47, 47, 0.8);
    }
}

.outro {
    font-size: 1.3em;
    color: #28a745;
    margin-top: 30px;
    font-weight: bold;
}

.expiry-note {
    margin-top: 40px;
    padding: 15px;
    background: rgba(255, 193, 7, 0.2);
    border: 2px solid #ffc107;
    border-radius: 10px;
    color: #856404;
    font-size: 0.9em;
}

.error-page {
    text-align: center;
    padding: 40px 20px;
}

.error-page h1 {
    font-size: 3em;
    margin-bottom: 20px;
}

.error-page p {
    font-size: 1.3em;
    color: #721c24;
}

.admin-sections {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.admin-section {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 15px;
    padding: 25px;
}

.admin-section h2 {
    color: #2a5298;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

.history-header strong {
    color: #2a5298;
    font-size: 1.1em;
}

.btn-delete {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-regenerate {
    background: #28a745;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
}

.btn-regenerate:hover {
    background: #218838;
}

.history-details p {
    margin: 8px 0;
    color: #666;
}

.assignments-list {
    margin-top: 15px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.assignment-row {
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
    font-family: monospace;
}

.assignment-row:last-child {
    border-bottom: none;
}

.assignment-row-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.assignment-row-with-action:last-child {
    border-bottom: none;
}

.assignment-row-with-action:hover {
    background: #f0f8ff;
}

.assignment-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.assignment-text {
    font-family: monospace;
    font-size: 1em;
}

.regenerated-badge {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
}

.btn-regenerate-small {
    background: #2a5298;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.2s;
}

.btn-regenerate-small:hover {
    background: #1e3c72;
    transform: scale(1.1);
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
}

.access-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.access-table thead {
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    color: white;
}

.access-table th,
.access-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.access-table th {
    font-weight: bold;
}

.access-table tbody tr:hover {
    background: #f8f9fa;
}

.status-not-opened {
    background: #fff3cd !important;
}

.status-opened {
    background: #d4edda !important;
}

.access-badge {
    background: #2a5298;
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.9em;
}

.status-not-opened .access-badge {
    background: #dc3545;
}

.access-details {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    max-height: 200px;
    overflow-y: auto;
}

.access-entry {
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9em;
}

.access-entry:last-child {
    border-bottom: none;
}

.exclusions-table-wrapper {
    overflow-x: auto;
    margin-top: 10px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    background: white;
}

.exclusions-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 300px;
}

.exclusions-table th,
.exclusions-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
}

.exclusions-table th {
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

.exclusions-table .name-column {
    text-align: left;
    font-weight: bold;
    background: #f8f9fa;
    color: #2a5298;
    position: sticky;
    left: 0;
    z-index: 5;
    min-width: 150px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exclusions-table thead .name-column {
    z-index: 15;
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    color: white;
}

.header-spacer,
.row-spacer {
    width: 10px;
    min-width: 10px;
    max-width: 10px;
    padding: 0 !important;
    background: #dee2e6;
    border: none;
}

.rotated-header {
    height: 120px;
    white-space: nowrap;
    position: relative;
    padding: 5px 3px !important;
    vertical-align: bottom;
}

.rotated-header > div {
    transform: rotate(-45deg);
    transform-origin: left bottom;
    width: 30px;
    position: absolute;
    bottom: 8px;
    left: 50%;
    margin-left: -15px;
}

.rotated-header > div > span {
    padding: 5px;
    font-size: 0.9em;
}

.checkbox-cell {
    background: white;
    transition: background-color 0.2s;
}

.checkbox-cell:hover {
    background: #f0f8ff;
}

.checkbox-cell input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #d42f2f;
}

.disabled-cell {
    color: #ccc;
    font-size: 1.2em;
    user-select: none;
}

.exclusions-table tbody tr:hover {
    background: #f8f9fa;
}

.exclusions-table tbody tr:hover .name-column {
    background: #e9ecef;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .receiver-name {
        font-size: 2em;
        padding: 20px;
    }
    
    .link-url {
        flex-direction: column;
    }
    
    .exclusions-table .name-column {
        min-width: 100px;
        font-size: 0.9em;
    }
    
    .rotated-header {
        height: 100px;
    }
    
    .rotated-header > div > span {
        font-size: 0.8em;
    }
}
