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

:root {
    --christmas-red: #c41e3a;
    --christmas-green: #165b33;
    --christmas-gold: #ffd700;
    --snow-white: #ffffff;
    --light-bg: #f8f9fa;
    --dark-text: #2d2d2d;
    --border-radius: 12px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #165b33 0%, #0f4024 100%);
    color: var(--dark-text);
    min-height: 100vh;
    position: relative;
}

/* Snowflakes animation */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -10%;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.5em;
    animation: fall linear infinite;
}

.snowflake:nth-child(1) { left: 10%; animation-duration: 10s; animation-delay: 0s; }
.snowflake:nth-child(2) { left: 30%; animation-duration: 12s; animation-delay: 2s; font-size: 2em; }
.snowflake:nth-child(3) { left: 50%; animation-duration: 8s; animation-delay: 4s; }
.snowflake:nth-child(4) { left: 70%; animation-duration: 11s; animation-delay: 1s; font-size: 1.8em; }
.snowflake:nth-child(5) { left: 90%; animation-duration: 9s; animation-delay: 3s; }

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

/* Login page styles */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 2;
}

.login-box {
    background: var(--snow-white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.login-box h1 {
    color: var(--christmas-red);
    margin-bottom: 10px;
    font-size: 1.8em;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
}

/* Main container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 2;
}

/* Header */
.header {
    background: var(--snow-white);
    padding: 20px 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    color: var(--christmas-red);
    font-size: 2em;
    flex: 1;
    min-width: 200px;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

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

.btn-primary:hover {
    background: #a01729;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(196, 30, 58, 0.3);
}

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

.btn-secondary:hover {
    background: #0f4024;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(22, 91, 51, 0.3);
}

.btn-logout {
    background: #666;
    color: var(--snow-white);
    padding: 10px 20px;
    font-size: 0.9em;
}

.btn-logout:hover {
    background: #444;
}

.btn-delete {
    background: #dc3545;
    color: var(--snow-white);
    padding: 8px 16px;
    font-size: 0.9em;
}

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

/* Forms */
.form-container {
    background: var(--snow-white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark-text);
    font-weight: 600;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-group input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--christmas-red);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group .help-text {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

/* Messages */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

/* Gift grid */
.gift-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.gift-card {
    background: var(--snow-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.gift-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.gift-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background: var(--light-bg);
}

.gift-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.gift-name {
    color: var(--christmas-red);
    font-size: 1.4em;
    margin-bottom: 10px;
    font-weight: 700;
}

.gift-price {
    color: var(--christmas-green);
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 12px;
}

.gift-description {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
    flex: 1;
}

.gift-url {
    margin-bottom: 12px;
}

.gift-url a {
    color: var(--christmas-red);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s ease;
}

.gift-url a:hover {
    color: #a01729;
    text-decoration: underline;
}

.gift-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.tag {
    background: var(--christmas-gold);
    color: var(--dark-text);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.gift-actions {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.gift-actions .btn {
    flex: 1;
    padding: 10px;
    font-size: 0.9em;
    text-align: center;
}

/* Empty state */
.empty-state {
    background: var(--snow-white);
    padding: 60px 30px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.empty-state h2 {
    color: var(--christmas-red);
    font-size: 2em;
    margin-bottom: 15px;
}

.empty-state p {
    color: #666;
    margin-bottom: 25px;
    font-size: 1.1em;
}

/* Responsive design */
@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }

    .header h1 {
        font-size: 1.5em;
        width: 100%;
        text-align: center;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

    .gift-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .form-container {
        padding: 20px;
    }

    .login-box {
        padding: 30px 20px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.95em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.3em;
    }

    .gift-image {
        height: 200px;
    }

    .gift-name {
        font-size: 1.2em;
    }

    .gift-actions {
        flex-direction: column;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
    }

    .header-actions .btn {
        width: 100%;
    }
}

/* Ranked List View */
.ranking-hint {
    background: var(--snow-white);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ranking-hint p {
    margin: 0;
    color: #666;
}

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

.ranked-item {
    background: var(--snow-white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}

.ranked-item[draggable="true"] {
    cursor: move;
}

.ranked-item[draggable="true"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.rank-number {
    font-size: 2em;
    font-weight: 700;
    color: var(--christmas-gold);
    min-width: 60px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.drag-handle {
    font-size: 1.5em;
    color: #999;
    cursor: move;
    user-select: none;
    padding: 0 5px;
}

.drag-handle:hover {
    color: var(--christmas-green);
}

.ranked-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    background: var(--light-bg);
    flex-shrink: 0;
}

.ranked-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    color: #ddd;
}

.ranked-content {
    flex: 1;
    min-width: 0;
}

.ranked-name {
    color: var(--christmas-red);
    font-size: 1.3em;
    margin-bottom: 8px;
    font-weight: 700;
}

.ranked-price {
    color: var(--christmas-green);
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 8px;
}

.ranked-description {
    color: #666;
    margin-bottom: 10px;
    line-height: 1.6;
    font-size: 0.95em;
}

.ranked-url {
    margin-bottom: 10px;
}

.ranked-url a {
    color: var(--christmas-red);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s ease;
}

.ranked-url a:hover {
    color: #a01729;
    text-decoration: underline;
}

.ranked-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ranked-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85em;
}

/* Responsive for ranked list */
@media (max-width: 768px) {
    .ranked-item {
        flex-wrap: wrap;
        gap: 15px;
    }

    .rank-number {
        font-size: 1.5em;
        min-width: 40px;
    }

    .ranked-image {
        width: 80px;
        height: 80px;
    }

    .ranked-name {
        font-size: 1.1em;
    }

    .ranked-price {
        font-size: 1.1em;
    }

    .ranked-actions {
        flex-direction: row;
        width: 100%;
    }

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

@media (max-width: 480px) {
    .ranked-item {
        padding: 15px;
    }

    .rank-number {
        font-size: 1.3em;
        min-width: 35px;
    }

    .drag-handle {
        font-size: 1.2em;
    }

    .ranked-image {
        width: 60px;
        height: 60px;
    }

    .ranked-content {
        width: 100%;
    }

    .ranked-actions {
        flex-direction: column;
    }
}
