* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;

    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    background: #f4f6fb;
    color: #1e1e1e;
}

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

body {
    background: #f4f4f4;
    font-family: Arial, sans-serif;
}

.app {
    width: min(100%, 900px);
    margin: 24px auto;
    padding: 28px;

    background: #ffffff;
    border-radius: 24px;

    box-shadow:
        0 10px 30px rgba(15, 23, 42, 0.08),
        0 2px 10px rgba(15, 23, 42, 0.05);

    border: 1px solid rgba(15, 23, 42, 0.06);

    transition: .25s ease;
}

.header {
    text-align: center;
    margin-bottom: 32px;
}

.header h1 {
    margin: 0;

    font-size: 34px;
    font-weight: 800;
    line-height: 1.1;

    color: #1f2937;
    letter-spacing: -0.02em;
}

.header h1::before {
    content: "📅";
    margin-right: 12px;
}

.calendar {
    min-height: 400px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
}

.weekdays,
#calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.weekdays {
    margin-bottom: 10px;
    font-weight: bold;
    text-align: center;
}

.day {
    aspect-ratio: 1;
    border: 1px solid #ddd;
    border-radius: 10px;

    display: flex;
    justify-content: center;
    align-items: center;

    background: white;

    position: relative;

    transition: 0.2s;
}

.day.selected {
    background-color: #4f8cff;
    font-weight: bold;
    border-color: #4f8cff;
}

.day.selected:not(.has-events) {
    color: white;
}

.day.selected.has-events {
    color: #111827;
}

/* Затемнение фона */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);

    display: flex;
    justify-content: center;
    align-items: center;
}

/* Скрыто */
.hidden {
    display: none;
}

/* Само окно */
.modal-content {
    background: white;

    border-radius: 22px;

    padding: 28px;

    box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
}

/* Крестик */
.close {
    position: absolute;
    top: 15px;
    right: 18px;

    cursor: pointer;

    font-size: 28px;
    font-weight: bold;
}

/* Кнопка */
#add-event-button {

    margin-top: 20px;

    width: 100%;

    padding: 12px;

    border: none;

    border-radius: 10px;

    cursor: pointer;

    background: #4f8cff;

    color: white;

    font-size: 16px;
}

.event-marker {
    position: absolute;
    bottom: 6px;
    right: 6px;

    min-width: 18px;
    height: 18px;
    padding: 0 5px;

    background: #2563eb;
    color: white;

    border-radius: 999px;

    display: flex;
    justify-content: center;
    align-items: center;

    font-size: 10px;
    font-weight: 700;

    box-sizing: border-box;
}

.day.has-events {
    background: #f3f8ff;
    border-color: #b9d3ff;
}

.day:hover {
    background: #e8f1ff;
    color: #111827;
    cursor: pointer;
}

.day.selected {
    background: #4f8cff !important;
    color: white !important;
    border-color: #4f8cff !important;
}

.day.selected .event-marker {
    background: white;
    color: #2563eb;
}

/* -------------------- */
/* Админ-панель */
/* -------------------- */

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 600px;
    margin-top: 30px;
}

.admin-form label {
    font-weight: bold;
    margin-bottom: -10px;
}

.admin-form input,
.admin-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d0d7e2;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
}

.admin-form textarea {
    min-height: 120px;
    resize: vertical;
}

.admin-form button {
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: #4f8cff;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: .2s;
}

.admin-form button:hover {
    background: #3b73e0;
}

.event-item {
    margin-bottom: 20px;
}

.event-time {
    font-size: 22px;
    font-weight: bold;
}

.event-title {
    display: flex;
    align-items: center;
    gap: 10px;

    font-size: 24px;
    font-weight: 700;

    margin: 18px 0 10px;
}

.event-poll {
    margin: 8px 0;
}

.event-poll a {
    color: #2563eb;
    text-decoration: none;
    font-weight: bold;
}

.event-poll a:hover {
    text-decoration: underline;
}

.event-description {
    margin-top: 12px;

    padding: 12px 14px;

    background: #f8fafc;

    border-radius: 10px;

    border: none;

    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);

    line-height: 1.6;
}

.event-poll {
    margin: 12px 0;
}

.event-poll a {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    margin-top: 12px;

    padding: 12px 18px;

    background: #4f8cff;
    color: white;

    text-decoration: none;

    border-radius: 12px;

    font-weight: 600;

    transition: .2s;
}

.event-poll a:hover {
    background: #3b82f6;
    transform: translateY(-2px);
}

.event-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
}

/* Общий стиль кнопок */

.edit-btn,
.duplicate-btn,
.delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    width: 100%;
    padding: 12px 16px;

    border-radius: 12px;
    border: 1px solid transparent;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition: all .2s ease;

    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}

.edit-btn {
    background: #eef5ff;
    color: #3b82f6;
    border-color: #bfdbfe;
}

.edit-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, .18);
}

.duplicate-btn {
    background: #f5f0ff;
    color: #7c3aed;
    border-color: #ddd6fe;
}

.duplicate-btn:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, .18);
}

.delete-btn {
    background: #fff1f2;
    color: #ef4444;
    border-color: #fecdd3;
}

.delete-btn:hover {
    background: #ffe4e6;
    border-color: #fda4af;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, .18);
}

/* ===== Категория ===== */

#category {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    border: 1px solid #d6dce8;
    border-radius: 12px;
    background: #ffffff;
    color: #222;
    cursor: pointer;
    transition: .2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5 8 12l6.5-6.5' stroke='%23666' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 45px;
}

#category:hover {
    border-color: #7da7ff;
}

#category:focus {
    outline: none;
    border-color: #4f7df3;
    box-shadow: 0 0 0 4px rgba(79, 125, 243, .18);
}

.event-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.event-actions button {
    flex: 1;
}

.event-location {
    margin-top: 16px;
    padding: 12px 14px;

    background: #f8fafc;

    border-radius: 10px;

    border: 1px solid #e2e8f0;

    line-height: 1.5;
}