/* Genel stil ayarları */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
    color: #334155;
    line-height: 1.65;
}

/* Turnuva container */
.tournament-container {
    max-width: 1480px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
    position: relative;
    min-height: calc(100vh - 160px);
}

/* Başlık */
.tournament-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    margin-bottom: 2.5rem;
    letter-spacing: -0.02em;
}

/* Aktif Turnuvalar */
.active-tournaments-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.active-tournaments {
    font-size: 1.1rem;
    color: #64748b;
    font-weight: 500;
}

/* Karusel container */
.carousel-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

/* Karusel */
.carousel {
    width: 100%;
    max-width: 1400px;
    overflow: hidden;
    position: relative;
}

/* Geçmiş Turnuvalar Karusel container */
.past-carousel-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Etkinlik bulunmadığında mesaj */
.no-events {
    text-align: center;
    font-size: 1.2rem;
    color: #64748b;
    padding: 2rem;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    margin: 0 auto;
    max-width: 1400px;
}

/* Turnuva kartı */
.tournament-card {
    display: none;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    max-width: 1400px;
    min-height: 620px;
    max-height: 620px;
    overflow: hidden;
    transition: transform 0.5s ease, opacity 0.5s ease;
    opacity: 0;
    transform: translateY(20px);
    margin: 0 auto;
}

.tournament-card.active {
    display: grid;
    grid-template-columns: 1fr 280px;
    grid-template-rows: auto 1fr auto auto;
    gap: 1rem;
    opacity: 1;
    transform: translateY(0);
}

/* Kart çakışmasını önleme */
.tournament-card.active + .tournament-card {
    display: none !important;
}

/* Kart başlığı ve durum */
.tournament-header {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.tournament-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}

.status {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
}

.status.ongoing {
    background-color: #dbeafe;
    color: #3b82f6;
}

.status.completed {
    background-color: #fef3c7;
    color: #d97706;
}

/* Kart detayları */
.tournament-details {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 420px;
    overflow-y: auto;
}

.tournament-details .detail-item {
    font-size: 0.95rem;
    color: #475569;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tournament-details strong {
    color: #1e293b;
    font-weight: 600;
}

/* Etkinlik tablosu */
.tournament-table {
    max-height: 140px;
    overflow-y: auto;
    position: relative;
    z-index: 0;
    border-radius: 8px;
    background: #f9fafb;
    padding: 0.5rem;
}

.tournament-table::-webkit-scrollbar {
    width: 6px;
}

.tournament-table::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.7);
    border-radius: 6px;
}

.tournament-table::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 6px;
    opacity: 0.8;
}

.tournament-table::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
    opacity: 1;
}

.tournament-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    color: #334155;
}

.tournament-table th,
.tournament-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.tournament-table th {
    font-weight: 600;
    color: #1e293b;
    background: #f1f5f9;
}

/* Text truncation ve bitişik görünüm */
.tournament-card.active .text-content {
    max-height: 3.3em;
    overflow: hidden;
    line-height: 1.65em;
    display: block;
    text-overflow: ellipsis;
    word-break: normal;
}

.tournament-card.active .text-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 1.5em;
    background: linear-gradient(to right, transparent, #ffffff 50%);
    pointer-events: none;
}

/* Modalda tam metin için normal görünüm */
#modalText {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.4;
    margin: 0;
}

/* Tarih ve format */
.tournament-footer {
    grid-column: 1 / 2;
    grid-row: 3 / 4;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 1rem;
}

.dates p,
.format p {
    font-size: 0.95rem;
    color: #475569;
}

.dates strong,
.format strong {
    color: #1e293b;
    font-weight: 600;
}

/* Katılanlar */
.participants {
    grid-column: 2 / 3;
    grid-row: 1 / 4;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 1.25rem;
    max-height: 560px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    position: relative;
}

.participants h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.8rem;
    position: sticky;
    top: 0;
    background: #f1f5f9;
    z-index: 1;
    padding-bottom: 0.5rem;
}

.participants-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
    padding-bottom: 40px; /* Space for tooltip at bottom */
}

.participants-list::-webkit-scrollbar {
    width: 6px;
}

.participants-list::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.7);
    border-radius: 6px;
}

.participants-list::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 6px;
    opacity: 0.8;
}

.participants-list::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
    opacity: 1;
}

.participants ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.participants li,
.participant-item {
    position: relative;
    z-index: 1;
    font-size: 0.9rem;
    color: #334155;
    padding: 0.5rem 0.8rem;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: background 0.3s ease, transform 0.2s ease, scale 0.2s ease;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.participants li:hover,
.participant-item:hover {
    z-index: 2;
    background: #e2e8f0;
    transform: translateX(3px) scale(1.02);
}

.participant-photo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    transition: transform 0.2s ease;
}

.participant-icon {
    font-size: 24px;
    margin-right: 8px;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.participant-name {
    vertical-align: middle;
}

/* Tooltip-like popup for hover effect */
.participant-tooltip {
    display: none;
    opacity: 0;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    transform: translateY(10px);
    background: #1e293b;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
    pointer-events: none;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    transform-origin: top left;
}

.participant-item:hover .participant-tooltip {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.participant-item:not(:hover) .participant-tooltip {
    display！我
    opacity: 0;
}

/* Last participant tooltip appears above (unless forced below) */
.last-participant .participant-tooltip {
    top: auto;
    bottom: calc(100% + 8px);
    transform: translateY(-10px);
    transform-origin: bottom left;
}

.last-participant:hover .participant-tooltip {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* Force tooltip below when scrolled to bottom */
.participant-tooltip.force-below {
    top: calc(100% + 8px);
    bottom: auto;
    transform: translateY(10px);
    transform-origin: top left;
}

.participant-item:hover .participant-tooltip.force-below,
.last-participant:hover .participant-tooltip.force-below {
    transform: translateY(0);
}

/* Right-align tooltip for edge cases */
.participant-tooltip.right-align {
    left: auto;
    right: 0;
    transform-origin: top right;
}

.last-participant .participant-tooltip.right-align {
    transform-origin: bottom right;
}

.participant-tooltip.force-below.right-align {
    transform-origin: top right;
}

.participant-tooltip img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.participant-tooltip .material-icons {
    font-size: 32px;
    color: #ffffff;
}

.participant-tooltip span {
    font-size: 1rem;
    font-weight: 500;
}

.participants p {
    font-size: 0.9rem;
    color: #64748b;
    font-style: italic;
    text-align: center;
    margin-top: 0.8rem;
}

/* Karusel Okları - Modern Tasarım */
.carousel-arrow {
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.active-left-arrow {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.2), 0 2px 4px -2px rgba(239, 68, 68, 0.1);
    left: -60px;
}

.active-left-arrow:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3), 0 4px 6px -4px rgba(239, 68, 68, 0.2);
    background: linear-gradient(135deg, #f87171 0%, #fca5a5 100%);
}

.active-right-arrow {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2), 0 2px 4px -2px rgba(16, 185, 129, 0.1);
    right: -60px;
}

.active-right-arrow:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3), 0 4px 6px -4px rgba(16, 185, 129, 0.2);
    background: linear-gradient(135deg, #34d399 0%, #6ee7b7 100%);
}

.past-left-arrow {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.2), 0 2px 4px -2px rgba(239, 68, 68, 0.1);
    left: -60px;
}

.past-left-arrow:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3), 0 4px 6px -4px rgba(239, 68, 68, 0.2);
    background: linear-gradient(135deg, #f87171 0%, #fca5a5 100%);
}

.past-right-arrow {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2), 0 2px 4px -2px rgba(16, 185, 129, 0.1);
    right: -60px;
}

.past-right-arrow:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3), 0 4px 6px -4px rgba(16, 185, 129, 0.2);
    background: linear-gradient(135deg, #34d399 0%, #6ee7b7 100%);
}

.carousel-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-arrow:disabled {
    background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
    cursor: not-allowed;
    opacity: 0.7;
}

.carousel-arrow i {
    font-size: 1.5em;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.active-left-arrow:hover i,
.past-left-arrow:hover i {
    transform: translateX(-2px);
}

.active-right-arrow:hover i,
.past-right-arrow:hover i {
    transform: translateX(2px);
}

/* Ekstra Stil Detayları */
.carousel-arrow::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

/* Eylem butonları */
.tournament-actions {
    grid-column: 1 / 2;
    grid-row: 4 / 5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1rem;
}

.action-btn {
    padding: 0.7rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.12);
}

.join-btn {
    background: #10b981;
    color: #ffffff;
}

.join-btn:hover {
    background: #059669;
}

.leave-btn {
    background: #ef4444;
    color: #ffffff;
}

.leave-btn:hover {
    background: #dc2626;
}

.register-btn {
    background: #facc15;
    color: #1e293b;
}

.register-btn:hover {
    background: #eab308;
}

.edit-btn {
    background: #3b82f6;
    color: #ffffff;
}

.edit-btn:hover {
    background: #2563eb;
}

.table-btn {
    background: #8b5cf6;
    color: #ffffff;
}

.table-btn:hover {
    background: #7c3aed;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal[style*="display: flex"] {
    pointer-events: auto;
}

.text-modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: auto;
}

.text-modal-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.text-modal-content .dialog-btn.cancel {
    padding: 0.7rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    background: #ef4444;
    color: #ffffff;
   
}

.text-modal-content .dialog-btn.cancel:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.12);
}

#modalText {
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    padding-right: 10px;
}

#modalText::-webkit-scrollbar {
    width: 6px;
}

#modalText::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.7);
    border-radius: 6px;
}

#modalText::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 6px;
    opacity: 0.8;
}

#modalText::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
    opacity: 1;
}

/* Bildirim */
.notification-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
}

/* Bildirim */
.notification {
    background: #ffffff;
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.6rem;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    max-width: 300px;
    font-size: 0.85rem;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid #10b981;
    color: #065f46;
}

.notification.error {
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

/* Geçmiş turnuvalar container */
.past-tournaments-container {
    max-width: 1480px;
    margin: 0 auto;
}

.past-tournaments-grid {
    width: 100%;
    max-width: 1400px;
    overflow: hidden;
    position: relative;
    margin: 0 auto;
}

/* Show more button */
.show-more-btn {
    color: #3b82f6;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 0.4rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.3s ease, transform 0.2s ease;
}

.show-more-btn:hover {
    color: #2563eb;
    transform: translateY(-1px);
}

/* Medya Sorguları */
@media (max-width: 768px) {
    /* Genel container */
    .tournament-container {
        padding: 0.8rem;
        margin: 1.5rem auto;
    }

    /* Başlık */
    .tournament-title {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }

    /* Aktif Turnuvalar */
    .active-tournaments-wrapper {
        margin-bottom: 1rem;
    }

    .active-tournaments {
        font-size: 1rem;
    }

    .carousel-container {
        margin-bottom: 1.5rem;
    }

    .carousel-arrow {
        width: 40px;
        height: 40px;
    }

    .carousel-arrow i {
        font-size: 1.2em;
    }

    .active-left-arrow {
        left: -48px;
    }

    .active-right-arrow {
        right: -48px;
    }

    .past-left-arrow {
        left: -48px;
    }

    .past-right-arrow {
        right: -48px;
    }

    /* Kart genel yapısı */
    .tournament-card.active {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto;
        padding: 1rem;
        border-radius: 12px;
        gap: 0.8rem;
        min-height: auto;
        max-height: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        margin: 0;
    }

    /* Kart başlık ve durum */
    .tournament-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }

    .tournament-header h2 {
        font-size: 1.4rem;
    }

    .status {
        font-size: 0.75rem;
        padding: 0.3rem 0.8rem;
    }

    /* Detaylar */
    .tournament-details {
        gap: 0.8rem;
        max-height: none;
        overflow: visible;
    }

    .tournament-details .detail-item {
        font-size: 0.9rem;
    }

    /* Tablo görünümü */
    .tournament-table {
        max-height: 100px;
        padding: 0.4rem;
    }

    .tournament-table table {
        font-size: 0.85rem;
    }

    /* Katılımcılar */
    .participants {
        grid-column: 1 / 2;
        grid-row: 5 / 6;
        max-height: 240px;
        padding: 1rem;
        border-radius: 10px;
        overflow: visible;
    }

    .participants h3 {
        font-size: 1.1rem;
        padding-bottom: 0.5rem;
    }

    .participants-list {
        max-height: 180px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 40px; /* Space for tooltip at bottom */
    }

    .participants li,
    .participant-item {
        font-size: 0.85rem;
        padding: 0.4rem 0.7rem;
    }

    /* Tooltip mobil uyumluluğu */
    .participant-tooltip {
        top: calc(100% + 8px);
        left: 0;
        transform: translateY(10px);
    }

    .last-participant .participant-tooltip {
        top: auto;
        bottom: calc(100% + 8px);
        transform: translateY(-10px);
    }

    .participant-tooltip.force-below {
        top: calc(100% + 8px);
        bottom: auto;
        transform: translateY(10px);
    }

    .participant-item:hover .participant-tooltip,
    .last-participant:hover .participant-tooltip,
    .participant-item:hover .participant-tooltip.force-below,
    .last-participant:hover .participant-tooltip.force-below {
        transform: translateY(0);
    }

    /* Alt bilgiler */
    .tournament-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
        margin-top: 0.8rem;
    }

    .dates p,
    .format p {
        font-size: 0.9rem;
    }

    /* Butonlar */
    .tournament-actions {
        margin-top: 0.8rem;
        gap: 0.6rem;
    }

    .action-btn {
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
        width: 100%;
    }

    /* Metin içeriği */
    .tournament-card.active .text-content {
        max-height: 3em;
        display: block;
        text-overflow: ellipsis;
    }

    /* Bildirim */
    .notification {
        max-width: 90%;
        padding: 0.7rem 1rem;
        font-size: 0.8rem;
    }

    /* Modal */
    .text-modal-content {
        max-width: 95%;
        padding: 15px;
    }

    .text-modal-content h3 {
        font-size: 1.3rem;
    }

    .text-modal-content .dialog-btn.cancel {
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }

    #modalText {
        max-height: 300px;
        font-size: 0.9rem;
        line-height: 1.4;
    }
}