/* DOKŁADNE STYLE Z KALENDARZ10.PHP */
        body { font-family: sans-serif; background: #f4f7f6; padding: 20px; margin: 0; }
        .container { max-width: 1050px; margin: auto; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,.1); }
        .btn { padding: 5px 10px; cursor: pointer; border: none; border-radius: 3px; color: #fff; font-size: 13px; }
        .btn-add  { background: #28a745; }
        .btn-del  { background: #dc3545; }
        .btn-edit { background: #007bff; }
        .btn-cancel { background: #6c757d; }
        .msg { padding: 10px; border-radius: 4px; margin-bottom: 15px; }
        .msg-success { color: #155724; background: #d4edda; border: 1px solid #c3e6cb; }
        .msg-error   { color: #721c24; background: #f8d7da; border: 1px solid #f5c6cb; }

        /* MODAL */
        .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1000; align-items: center; justify-content: center; }
        .modal-overlay.active { display: flex; }
        .modal { background: #fff; border-radius: 8px; padding: 28px 32px; width: 100%; max-width: 1050px; box-shadow: 0 8px 32px rgba(0,0,0,.2); position: relative; max-height: 90vh; display: flex; flex-direction: column; }
        .modal h2 { margin: 0 0 18px; font-size: 1.1rem; }
        .modal label { display: block; font-size: 13px; margin: 10px 0 3px; color: #444; font-weight: bold; }
        .modal input, .modal select { width: 100%; box-sizing: border-box; padding: 7px 9px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; }
        .modal input:focus, .modal select:focus { border-color: #007bff; outline: none; box-shadow: 0 0 0 2px rgba(0,123,255,.2); }
        .modal-footer { margin-top: 22px; display: flex; justify-content: flex-end; gap: 8px; }
        .modal-close { position: absolute; top: 10px; right: 14px; background: none; border: none; font-size: 22px; cursor: pointer; color: #aaa; line-height: 1; padding: 0; }
        .modal-close:hover { color: #333; }
        .modal-body { overflow-y: auto; padding-right: 5px; }

        /* ELEMENTY SPECYFICZNE DLA KALENDARZA */
        .top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; position: sticky; top: 0; z-index: 20; background: #fff; padding: 8px 0; border-bottom: 1px solid #eee; }
        .top-bar h1 { margin: 0; font-size: 1.8rem; color: #333; }
        .controls-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
        .filter-select { padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; background: #fff; }
        .role-toggle { font-size: 13px; font-weight: bold; display: flex; align-items: center; gap: 5px; cursor: pointer; padding: 6px 12px; border: 1px solid #007bff; border-radius: 4px; background: #fff; color: #007bff; text-decoration: none; transition: 0.2s; }
        .role-toggle.active { background: #007bff; color: #fff; }
        
        .auth-link { font-size: 13px; font-weight: bold; color: #007bff; text-decoration: none; padding: 6px 12px; border: 1px solid #007bff; border-radius: 4px; transition: 0.2s; display: inline-flex; align-items: center; gap: 5px; }
        .auth-link:hover { background: #007bff; color: #fff; }

        .calendar-header { display: flex; justify-content: space-between; align-items: center; background: #333; color: #fff; padding: 12px 20px; border-radius: 5px 5px 0 0; }
        .calendar-header button { background: none; border: none; font-size: 18px; cursor: pointer; color: #fff; font-weight: bold; }
        .calendar-header button:hover { color: #aaa; }
        .month-year { font-size: 1.1rem; font-weight: bold; text-transform: capitalize; }

        .calendar-wrapper { border: 1px solid #ddd; border-top: none; border-radius: 0 0 5px 5px; background: #fff; }
        
        /* DOKŁADNE SZEROKOŚCI KOLUMN Z KALENDARZ10.PHP */
        .calendar-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.8fr) minmax(0, 1.8fr) minmax(0, 1.8fr); }
        
        .day-name { text-align: center; font-weight: bold; font-size: 13px; color: #333; padding: 10px 0; border-bottom: 1px solid #ddd; background: #eee; }
        
        .day-cell { min-height: 120px; border-right: 1px solid #ddd; border-bottom: 1px solid #ddd; padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
        .day-cell:nth-child(7n) { border-right: none; }
        .day-cell.weekend { background: #fafafa; }
        .day-cell:hover { background: #f0f8ff; }
        .day-cell.empty { background: #f9f9f9; cursor: default; }
        .day-cell.adjacent-month { background: #f9f9f9; }
        .day-cell.adjacent-month .day-number { color: #aaa; }
        .day-number { font-weight: bold; font-size: 13px; color: #666; align-self: flex-end; margin-bottom: 4px; }
        .day-cell.today { background:#e8f2ff; border:3px solid #0067c5; box-shadow:inset 0 0 0 2px rgba(255,255,255,.9), 0 0 0 2px rgba(0,103,197,.18); position:relative; }
        .day-cell.today:hover { background:#dcecff; }
        .day-cell.today .day-number { background:#0067c5; color:#fff; padding:4px 9px; border-radius:999px; font-size:14px; box-shadow:0 2px 6px rgba(0,79,153,.28); }
        .day-cell.today::after { content:""; position:absolute; top:7px; left:7px; width:9px; height:9px; border-radius:50%; background:#0067c5; box-shadow:0 0 0 4px rgba(0,103,197,.16); pointer-events:none; }

        .event-card { background: #e9ecef; border-left: 3px solid #007bff; padding: 5px; border-radius: 3px; font-size: 11px; color: #333; overflow: hidden; position: relative; cursor: help; transition: background 0.2s; }
        .event-card:hover { background: #dbe4f0; }
        .event-card.club-submitted { border:2px solid #16a34a; border-left-width:5px !important; background:#f0fdf4; }
        .event-list-item.club-submitted { border:2px solid #16a34a; border-left-width:5px !important; background:#f0fdf4; }
        .event-list-item.club-submitted:hover { background:#dcfce7; }
        .club-submitted-badge { display:inline-flex !important; align-items:center; justify-content:center; min-width:24px; height:24px; padding:0 7px; border-radius:12px; background:#15803d; color:#fff !important; font-size:15px; line-height:1; font-weight:900; font-family:Arial,sans-serif; flex:0 0 auto; box-shadow:0 0 0 2px #fff,0 1px 3px rgba(0,0,0,.25); position:relative; z-index:2; }
        .event-card.deadline-overdue { background: #fff5f5; border-left-color: #dc3545 !important; }
        .event-card * { pointer-events: none; } 
        
        .event-card strong { display: block; color: #007bff; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; margin-bottom: 2px; }
        .event-card .loc { color: #666; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: block; }
        .event-card.has-logo-watermark { min-height:76px; overflow:hidden; isolation:isolate; background:#fff; }
        .event-card-logo-watermark { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; object-position:center; opacity:.72; z-index:0; pointer-events:none; transform:scale(1.12); }
        .event-card.has-logo-watermark > :not(.event-card-logo-watermark) { position:relative; z-index:1; }
        .event-card.has-logo-watermark > div, .event-card.has-logo-watermark > .loc { background:rgba(255,255,255,.48); text-shadow:0 1px 1px #fff; }
        @media (max-width:700px) { .event-card.has-logo-watermark { min-height:66px; } .event-card-logo-watermark { opacity:.66; transform:scale(1.08); } }
        .more-events { font-size: 10px; font-weight: bold; color: #666; text-align: center; background: #ddd; padding: 2px; border-radius: 3px; margin-top: 2px; }

        .event-list-item { border: 1px solid #ddd; border-radius: 4px; padding: 10px; margin-bottom: 10px; background: #f9f9f9; cursor: pointer; transition: 0.2s; }
        .event-list-item:hover { border-color: #007bff; background: #f0f8ff; }
        .event-list-item.deadline-overdue { border-color: #f5c2c7; background: #fff5f5; }
        .event-list-item h4 { color: #007bff; margin: 0 0 5px; font-size: 14px; }
        .event-list-item p { font-size: 12px; margin: 2px 0; color: #555; }
        .deadline-chip-mini { display:inline-block; margin-top:4px; font-size:10px; font-weight:700; color:#842029; background:#f8d7da; border:1px solid #f1aeb5; border-radius:999px; padding:2px 7px; }

        /* TOOLTIP */
        .custom-tooltip { 
            position: fixed; background: rgba(30, 41, 59, 0.97); color: #fff; 
            padding: 12px 15px; border-radius: 8px; font-size: 13px; width: 310px; 
            box-shadow: 0 10px 25px rgba(0,0,0,0.28); pointer-events: none; z-index: 9999; 
            opacity: 0; visibility: hidden; transform: translateY(5px); 
            transition: opacity 0.2s, transform 0.2s; backdrop-filter: blur(4px);
            border: 1px solid rgba(255,255,255,0.14);
        }
        .custom-tooltip.active { opacity: 1; visibility: visible; transform: translateY(0); }
        .custom-tooltip-logo-wrap { display:none; width:100%; height:150px; margin:0 0 10px; align-items:center; justify-content:center; overflow:hidden; border-radius:6px; background:#fff; border:1px solid rgba(255,255,255,.28); }
        .custom-tooltip.has-logo .custom-tooltip-logo-wrap { display:flex; }
        .custom-tooltip-logo { display:block; width:100%; height:100%; object-fit:contain; padding:8px; box-sizing:border-box; }
        .custom-tooltip h4 { color: #93c5fd; margin: 0 0 8px; font-size: 14px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 5px; }
        .custom-tooltip p { margin: 4px 0; color: #e2e8f0; }
        .custom-tooltip .tt-organizer-inline { display:inline-block; margin-top:5px; color:#e2e8f0; font-weight:600; }
        @media (max-width:700px) { .custom-tooltip { width:260px; } .custom-tooltip-logo-wrap { height:120px; } }

        /* SZCZEGÓŁY ZAWODÓW */
        .details-row { display: flex; border-bottom: 1px solid #eee; padding: 8px 0; font-size: 14px; }
        .details-row:last-child { border-bottom: none; }
        .details-label { width: 130px; font-weight: bold; color: #555; }
        .details-value { flex: 1; color: #222; }

        /* NOWE ELEMENTY (Search & View Toggle) - Dopasowane do stylu kalendarz10.php */
        .search-input { padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; width: 200px; }
        .view-toggle { display: flex; background: #eee; padding: 2px; border-radius: 4px; gap: 2px; }
        .view-toggle button { border: none; background: none; padding: 4px 8px; font-size: 11px; font-weight: bold; cursor: pointer; border-radius: 3px; color: #666; }
        .view-toggle button.active { background: #fff; color: #007bff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
        .lang-flag { text-decoration: none; padding: 3px 5px; font-size: 16px; line-height: 1; border-radius: 4px; border: 1px solid transparent; }
        .lang-flag:hover { background: #f0f6ff; border-color: #cfe2ff; }
        .lang-flag.is-active { border-color: #007bff; box-shadow: 0 0 0 1px rgba(0,123,255,.2) inset; }
        .lang-flag img { width: 20px; height: 15px; display: block; border-radius: 2px; }
        .flag-inline { width: 16px; height: 12px; vertical-align: -2px; margin-right: 4px; border-radius: 2px; border: 1px solid #ddd; }
        .flag-inline-emoji { margin-right: 4px; }
        .country-combo { position: relative; min-width: 210px; }
        .country-combo-btn { width: 100%; min-height: 31px; border: 1px solid #ccc; border-radius: 4px; background: #fff; padding: 6px 10px; font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; }
        .country-combo-btn:hover { border-color: #b8b8b8; }
        .country-combo-btn:focus { outline: none; border-color: #007bff; box-shadow: 0 0 0 2px rgba(0,123,255,.2); }
        .country-combo-btn .country-combo-label { display: inline-flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .country-combo-list { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; overflow: auto; background: #fff; border: 1px solid #ccc; border-radius: 6px; box-shadow: 0 8px 20px rgba(0,0,0,.12); z-index: 50; }
        .country-combo.open .country-combo-list { display: block; }
        .country-combo-item { width: 100%; border: none; border-bottom: 1px solid #f1f1f1; background: #fff; text-align: left; padding: 7px 10px; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
        .country-combo-item:last-child { border-bottom: none; }
        .country-combo-item:hover { background: #f5f9ff; }
        .country-combo-item.is-active { background: #eaf3ff; font-weight: bold; }
        .list-view-grid { display: flex; flex-direction: column; padding: 16px; gap: 16px; }
        .event-list-item.has-list-logo { display:grid; grid-template-columns:104px minmax(0,1fr); gap:14px; align-items:center; }
        .event-list-logo-wrap { width:104px; height:76px; display:flex; align-items:center; justify-content:center; overflow:hidden; border:1px solid #d7e0ea; border-radius:8px; background:#fff; box-shadow:0 2px 6px rgba(15,23,42,.08); }
        .event-list-logo { display:block; width:100%; height:100%; object-fit:contain; padding:6px; box-sizing:border-box; }
        .event-list-content { min-width:0; }
        .event-type-chips {display:flex;flex-wrap:wrap;gap:5px;margin-top:6px}.event-type-chip{display:inline-flex;padding:3px 7px;border-radius:999px;background:#e7f1ff;color:#0a58ca;border:1px solid #bdd7ff;font-size:10px;font-weight:800}.custom-tooltip .event-type-chip{background:rgba(147,197,253,.18);color:#dbeafe;border-color:rgba(147,197,253,.42)}
        @media (max-width:640px) { .event-list-item.has-list-logo { grid-template-columns:76px minmax(0,1fr); gap:10px; } .event-list-logo-wrap { width:76px; height:60px; } }


        /* RESPONSYWNOŚĆ */
        @media (max-width: 900px) {
            body { padding: 10px; }
            .container { padding: 12px; }
            .top-bar { position: static; border-bottom: none; padding: 0; }
            .controls-row { width: 100%; gap: 8px; }
            .controls-row > .search-input,
            .controls-row > .filter-select,
            .controls-row > .country-combo,
            .controls-row > .auth-link,
            .controls-row > .role-toggle { width: 100%; box-sizing: border-box; }
            .controls-row .view-toggle { width: 100%; justify-content: stretch; }
            .controls-row .view-toggle button { flex: 1; }
            .calendar-grid { display: flex; flex-direction: column; }
            .day-name { display: none; }
            .day-cell { min-height: auto; padding: 15px; flex-direction: row; gap: 15px; align-items: flex-start; }
            .day-cell.empty { display: none; }
            .day-number { align-self: flex-start; min-width: 30px; margin-bottom: 0; font-size: 14px; }
            .day-cell::before { content: attr(data-dayname); font-weight: bold; font-size: 12px; color: #666; text-transform: uppercase; width: 40px; display: block; margin-top: 2px; }
            .day-cell .events-container { flex: 1; display: flex; flex-direction: column; gap: 6px; }
            .event-card { font-size: 12px; padding: 8px; }
            .custom-tooltip { display: none !important; }
        }
    
        .guest-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
        .guest-lang { position:relative; }
        .guest-lang summary { list-style:none; display:flex; align-items:center; gap:5px; background:#fff; color:#334155; border:1px solid #b8c8d8; border-radius:4px; padding:5px 8px; cursor:pointer; font-size:12px; font-weight:700; }
        .guest-lang summary::-webkit-details-marker { display:none; }
        .guest-lang summary img,.guest-lang-list img { width:20px; height:15px; border-radius:2px; border:1px solid #d5dbe5; object-fit:cover; }
        .guest-lang-list { position:absolute; right:0; top:calc(100% + 5px); z-index:1000; min-width:185px; max-height:310px; overflow-y:auto; background:#fff; border:1px solid #cbd5e1; border-radius:6px; box-shadow:0 8px 24px rgba(15,23,42,.18); padding:5px; }
        .guest-lang-list a { display:flex; align-items:center; gap:8px; padding:7px 8px; border-radius:4px; color:#1f2937; text-decoration:none; font-size:12px; }
        .guest-lang-list a:hover,.guest-lang-list a.is-current { background:#e9f5ff; color:#075985; }
