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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #498cb1 0%, #5cc0f5 100%);
    min-height: 100vh;
}

header {
    position: relative;
    background: linear-gradient(135deg, rgba(73, 140, 177, 0.95) 0%, rgba(92, 192, 245, 0.95) 100%);
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background-image:
        linear-gradient(to bottom, transparent 0%, transparent 40%, rgba(0, 0, 0, 0.05) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 300' preserveAspectRatio='none'%3E%3Cpath d='M0,100 L200,80 L400,120 L600,90 L800,110 L1000,95 L1200,105 L1200,300 L0,300 Z' fill='rgba(255,255,255,0.1)'/%3E%3Cpath d='M0,150 L150,130 L300,160 L500,140 L700,165 L900,145 L1200,155 L1200,300 L0,300 Z' fill='rgba(255,255,255,0.08)'/%3E%3Cpath d='M0,200 L250,180 L450,210 L650,190 L850,205 L1050,195 L1200,200 L1200,300 L0,300 Z' fill='rgba(255,255,255,0.12)'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: bottom;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
}

header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: headerShine 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes headerShine {
    0%, 100% {
        opacity: 0.3;
        transform: translate(0, 0);
    }
    50% {
        opacity: 0.5;
        transform: translate(10%, 10%);
    }
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.header-logo {
    height: 280px;
    width: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.header-logo:hover {
    transform: scale(1.05);
}

.header-text {
    text-align: left;
}

header h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.5px;
}

header p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.3rem;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

header a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

header a:hover {
    color: white;
    border-bottom: 2px solid white;
    text-decoration: none;
}

.search-container {
    max-width: 1200px;
    margin: 2rem auto 0;
    padding: 0 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.search-wrapper {
    flex-grow: 1;
    position: relative;
}

#search-input {
    width: 100%;
    padding: 0.75rem 1.25rem;
    border: 2px solid #498cb1;
    border-radius: 50px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#search-input:focus {
    outline: none;
    border-color: #3a7a9e;
    box-shadow: 0 4px 12px rgba(73, 140, 177, 0.3);
}

.search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #498cb1;
    border-radius: 12px;
    margin-top: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.dropdown-item {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

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

.dropdown-item:hover {
    background-color: #f0f8ff;
}

.dropdown-item.no-results {
    color: #999;
    text-align: center;
    cursor: default;
}

.dropdown-item.no-results:hover {
    background-color: white;
}

.dropdown-item-name {
    font-weight: 600;
    color: #498cb1;
    margin-bottom: 0.25rem;
}

.dropdown-item-desc {
    font-size: 0.9rem;
    color: #666;
}

#search-count {
    color: white;
    font-size: 0.9rem;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin-top: 0.5rem;
}

.ticket-checker-container {
    max-width: 1200px;
    margin: 1.5rem auto 0;
    padding: 0 1rem;
}

.ticket-checker {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.rules-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}

.rules-header:hover {
    background: rgba(255, 255, 255, 1);
}

.rules-header h3 {
    color: #498cb1;
    margin: 0;
    font-size: 1.3rem;
}

.toggle-icon {
    color: #498cb1;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.rules-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    margin-top: 0.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#rules-text {
    color: #333;
    font-size: 1rem;
    line-height: 1.8;
}

.ticket-checker h3 {
    color: #498cb1;
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.ticket-checker p {
    color: #666;
    margin-bottom: 1rem;
}

.ticket-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#ticket-input {
    flex-grow: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #498cb1;
    border-radius: 6px;
    font-size: 1rem;
}

#ticket-input:focus {
    outline: none;
    border-color: #3a7a9e;
    box-shadow: 0 0 0 3px rgba(73, 140, 177, 0.1);
}

.btn-check,
.btn-clear {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-check {
    background: #498cb1;
    color: white;
}

.btn-check:hover {
    background: #3a7a9e;
}

.btn-clear {
    background: #6c757d;
    color: white;
}

.btn-clear:hover {
    background: #5a6268;
}

#ticket-results {
    margin-top: 1rem;
}

.ticket-success {
    background: #d4edda;
    border: 2px solid #28a745;
    border-radius: 8px;
    padding: 1.5rem;
}

.ticket-success h4 {
    color: #155724;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.winner-list {
    list-style: none;
    padding: 0;
}

.winner-list li {
    background: white;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border-left: 4px solid #28a745;
}

.ticket-no-win {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 1.5rem;
    color: #856404;
}

.ticket-error {
    color: #dc3545;
    background: #f8d7da;
    padding: 0.75rem;
    border-radius: 6px;
    border: 2px solid #dc3545;
}

.hint-text {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-style: italic;
}

.winner-highlight {
    border: 3px solid #28a745;
    box-shadow: 0 0 20px rgba(40, 167, 69, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(40, 167, 69, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(40, 167, 69, 0.6);
    }
}

.winner-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #28a745;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

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

#raffles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.raffle-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

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

.raffle-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #f0f0f0;
}

.raffle-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.raffle-content {
    padding: 1.5rem;
}

.raffle-content h2 {
    color: #498cb1;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.raffle-description {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.winning-number {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #498cb1;
}

.winning-number strong {
    color: #333;
    display: block;
    margin-bottom: 0.5rem;
}

.has-winner {
    color: #28a745;
    font-size: 1.3rem;
    font-weight: bold;
}

.no-winner {
    color: #999;
    font-style: italic;
}

.form-container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.auth-form h2,
.content-form h2 {
    color: #498cb1;
    margin-bottom: 1.5rem;
    text-align: center;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-group input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #498cb1;
}

.image-upload-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-btn:hover {
    background: #e8e8e8;
    border-color: #d0d0d0;
}

.tab-btn.active {
    background: #498cb1;
    color: white;
    border-color: #498cb1;
}

.upload-section {
    margin-bottom: 0.5rem;
}

.btn-primary,
.btn-secondary,
.btn-small {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-primary {
    background: #498cb1;
    color: white;
    width: 100%;
    margin-bottom: 0.5rem;
}

.btn-primary:hover {
    background: #3a7a9e;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    width: 100%;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-small {
    background: #498cb1;
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-small:hover {
    background: #3a7a9e;
}

.error-message {
    color: #dc3545;
    padding: 0.75rem;
    background: #f8d7da;
    border-radius: 6px;
    margin-top: 1rem;
    text-align: center;
}

.success-message {
    color: #28a745;
    padding: 0.75rem;
    background: #d4edda;
    border-radius: 6px;
    margin-top: 1rem;
    text-align: center;
}

.hint {
    text-align: center;
    color: #999;
    font-size: 0.9rem;
    margin-top: 1rem;
}

#loading,
.no-raffles,
.error {
    text-align: center;
    padding: 3rem;
    color: white;
    font-size: 1.2rem;
}

footer {
    background: rgba(255, 255, 255, 0.95);
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

.admin-links {
    margin-top: 1rem;
}

.admin-links a {
    color: #498cb1;
    text-decoration: none;
    margin: 0 0.5rem;
}

.admin-links a:hover {
    text-decoration: underline;
}

.raffle-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 1rem;
}

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

.raffle-table th {
    background: #498cb1;
    color: white;
    font-weight: 600;
}

.raffle-table tr:last-child td {
    border-bottom: none;
}

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

.raffle-table tbody tr[draggable="true"] {
    cursor: move;
    transition: background-color 0.2s ease;
}

.raffle-table tbody tr[draggable="true"]:active {
    cursor: grabbing;
}

.raffle-table tbody tr.drag-over {
    background: #e3f2fd !important;
    border-top: 2px solid #498cb1;
    border-bottom: 2px solid #498cb1;
}

.drag-handle {
    cursor: grab;
    user-select: none;
    font-size: 1.2rem;
    color: #999;
    text-align: center;
    font-weight: bold;
}

.drag-handle:active {
    cursor: grabbing;
}

.reorder-instructions {
    background: #e3f2fd;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #498cb1;
}

.reorder-instructions p {
    margin: 0;
    color: #333;
    font-size: 0.95rem;
}

.admin-search-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-search-container input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.admin-search-container input:focus {
    outline: none;
    border-color: #498cb1;
}

#admin-search-count {
    color: #666;
    font-size: 0.95rem;
    white-space: nowrap;
}

#raffle-list {
    margin-top: 2rem;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

#raffles-list-container {
    max-height: 500px;
    overflow-y: auto;
}

#rules-editor {
    margin-top: 2rem;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

#rules-editor h2 {
    color: #498cb1;
    margin-bottom: 1.5rem;
}

#rules-textarea {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

.winner-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid #e0e0e0;
    display: flex;
    gap: 1.5rem;
}

.winner-card-image {
    flex-shrink: 0;
}

.winner-card-image img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

.winner-card-content {
    flex-grow: 1;
}

.winner-card-content h3 {
    color: #498cb1;
    margin-bottom: 0.5rem;
}

.winner-form-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
}

.winner-form-group label {
    font-weight: 500;
    white-space: nowrap;
}

.winner-form-group input {
    flex-grow: 1;
    padding: 0.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
}

.winner-form-group input:focus {
    outline: none;
    border-color: #498cb1;
}

.form-message {
    margin-top: 0.5rem;
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
}

.close {
    color: #aaa;
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: #498cb1;
}

.btn-action {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 0.25rem;
}

.btn-edit {
    background: #498cb1;
    color: white;
}

.btn-edit:hover {
    background: #3a7a9e;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

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

.btn-winner {
    background: #28a745;
    color: white;
}

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

.winner-update-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.winner-input {
    flex-grow: 1;
    padding: 0.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 100px;
}

.winner-input:focus {
    outline: none;
    border-color: #498cb1;
}

.winner-message {
    margin-top: 0.25rem;
    font-size: 0.85rem;
}

.success-text {
    color: #28a745;
    font-weight: 600;
}

.error-text {
    color: #dc3545;
    font-weight: 600;
}

@media (max-width: 768px) {
    header {
        padding: 2rem 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1.5rem;
    }

    .header-logo {
        height: 200px;
    }

    .header-text {
        text-align: center;
    }

    header h1 {
        font-size: 2rem;
        letter-spacing: -0.3px;
    }

    header p {
        font-size: 1.1rem;
    }

    .search-container {
        flex-direction: column;
        align-items: stretch;
    }

    #search-count {
        text-align: center;
        margin-top: 0.5rem;
    }

    .search-dropdown {
        max-height: 300px;
    }

    .dropdown-item {
        padding: 0.75rem;
    }

    .dropdown-item-name {
        font-size: 0.95rem;
    }

    .dropdown-item-desc {
        font-size: 0.85rem;
    }

    #raffles-container {
        grid-template-columns: 1fr;
    }

    .winner-card {
        flex-direction: column;
    }

    .winner-card-image img {
        width: 100%;
        height: auto;
    }

    .winner-form-group {
        flex-direction: column;
        align-items: stretch;
    }

    .winner-form-group label {
        margin-bottom: 0.5rem;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1.5rem;
    }

    .raffle-table {
        font-size: 0.9rem;
    }

    .raffle-table th,
    .raffle-table td {
        padding: 0.5rem;
    }

    .btn-action {
        display: block;
        width: 100%;
        margin: 0.25rem 0;
    }

    .winner-update-cell {
        flex-direction: column;
        align-items: stretch;
    }

    .winner-input {
        width: 100%;
    }

    .ticket-input-group {
        flex-direction: column;
    }

    .btn-check,
    .btn-clear {
        width: 100%;
    }

    .winner-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .admin-search-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    #admin-search-count {
        text-align: center;
        font-size: 0.9rem;
    }
}

/* Sponsor Management Styles */
.sponsors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.sponsor-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.sponsor-logo-preview {
    max-width: 150px;
    max-height: 80px;
    object-fit: contain;
}

.sponsor-info {
    text-align: center;
    font-size: 0.9rem;
}

.sponsor-link {
    color: #498cb1;
    font-size: 0.8rem;
    word-break: break-all;
}

.no-items {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}
