:root {
    --g-blue: #1a73e8;
    --g-gray-light: #f1f3f4;
    --g-gray: #dadce0;
    --g-text: #3c4043;
    --g-text-light: #70757a;
    --g-border: #dadce0;
    --g-white: #ffffff;
    --g-hover: #f1f3f4;
    --g-today-bg: #1a73e8;
    --g-today-text: #ffffff;
}

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

body {
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--g-text);
    background-color: var(--g-white);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.g-header {
    height: 64px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--g-border);
    flex-shrink: 0;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    margin-right: 24px;
}

.logo img {
    height: 40px;
    margin-right: 8px;
}

.logo-text {
    font-size: 18px;
    color: var(--g-text-light);
    font-weight: 500;
    white-space: nowrap;
}

.calendar-nav {
    display: flex;
    align-items: center;
    position: relative;
}

.btn-today {
    padding: 8px 16px;
    border: 1px solid var(--g-border);
    border-radius: 4px;
    text-decoration: none;
    color: var(--g-text);
    font-size: 14px;
    font-weight: 500;
    margin-right: 16px;
    transition: background 0.2s;
}

.btn-today:hover {
    background-color: var(--g-hover);
}

.nav-arrows {
    display: flex;
    margin-right: 16px;
}

.nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    text-decoration: none;
    color: var(--g-text);
    transition: background 0.2s;
}

.nav-btn:hover {
    background-color: var(--g-hover);
}

.nav-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.current-month {
    font-size: 20px;
    font-weight: 400;
    color: var(--g-text);
}

/* Right Header */
.lang-switcher, .view-switcher {
    display: flex;
    margin-right: 16px;
    border: 1px solid var(--g-border);
    border-radius: 4px;
    overflow: hidden;
}

.lang-switcher a, .view-switcher a {
    padding: 6px 12px;
    text-decoration: none;
    color: var(--g-text);
    font-size: 13px;
    font-weight: 500;
    border-right: 1px solid var(--g-border);
}

.lang-switcher a:last-child, .view-switcher a:last-child {
    border-right: none;
}

.lang-switcher a.active, .view-switcher a.active {
    background-color: #e8f0fe;
    color: var(--g-blue);
}

.btn-search-cert {
    padding: 8px 16px;
    border: 1px solid var(--g-border);
    border-radius: 4px;
    text-decoration: none;
    color: var(--g-text);
    font-size: 13px;
    font-weight: 500;
    margin-right: 16px;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-search-cert:hover {
    background-color: var(--g-hover);
}

.admin-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--g-text-light);
    transition: background 0.2s;
}

.admin-link:hover {
    background-color: var(--g-hover);
}

.admin-link svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Main Container */
.g-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.calendar-wrapper {
    flex-grow: 1;
    overflow: auto;
}

/* Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: 32px;
    grid-auto-rows: minmax(120px, auto);
    width: 100%;
}

.calendar-day-head {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--g-text-light);
    text-transform: uppercase;
    border-right: 1px solid var(--g-border);
    border-bottom: 1px solid var(--g-border);
}

.calendar-day-head:last-child {
    border-right: none;
}

.calendar-day {
    display: flex;
    flex-direction: column;
    min-height: 120px;
    height: auto;
    border-right: 1px solid var(--g-border);
    border-bottom: 1px solid var(--g-border);
    padding: 4px;
    transition: background 0.2s;
    overflow: visible;
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

.calendar-day.other-month {
    background-color: #f8f9fa;
}

.day-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    margin: 4px auto;
    border-radius: 50%;
    cursor: default;
}

.calendar-day.today .day-number {
    background-color: var(--g-today-bg);
    color: var(--g-today-text);
}

/* Events */
.event-link {
    display: block;
    background-color: var(--g-blue);
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    margin-bottom: 2px;
    border-radius: 4px;
    text-decoration: none;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    font-weight: 500;
}

.event-link:hover {
    filter: brightness(0.9);
}

/* List View */
.event-list {
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.event-list-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--g-border);
    transition: background 0.2s;
}

.event-list-item:hover {
    background-color: var(--g-hover);
}

.event-list-date {
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 24px;
}

.date-day {
    font-size: 24px;
    font-weight: 400;
}

.date-month {
    font-size: 12px;
    color: var(--g-text-light);
    text-transform: uppercase;
}

.event-list-content {
    flex-grow: 1;
}

.event-list-content h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.event-list-content h3 a {
    text-decoration: none;
    color: var(--g-text);
}

.event-list-time {
    font-size: 13px;
    color: var(--g-text-light);
    margin-bottom: 4px;
}

.event-list-desc {
    font-size: 13px;
    color: var(--g-text-light);
}

.event-list-action {
    margin-left: 16px;
}

.btn-primary {
    background-color: var(--g-blue);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

/* Tooltip */
.event-tooltip {
    position: absolute;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
    padding: 20px;
    width: 500px;
    max-width: 90vw;
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    border: 1px solid var(--g-border);
}

.event-tooltip h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--g-text);
    line-height: 1.4;
}

.tooltip-time {
    font-size: 13px;
    color: var(--g-text-light);
    margin-bottom: 12px;
    border-bottom: 1px solid var(--g-border);
    padding-bottom: 8px;
}

.tooltip-desc {
    font-size: 14px;
    color: var(--g-text);
    line-height: 1.6;
}

.tooltip-desc p {
    margin-bottom: 8px;
}

/* Mobile */
@media (max-width: 768px) {
    .g-header {
        flex-direction: column;
        height: auto;
        padding: 12px;
    }
    
    .header-left {
        width: 100%;
        justify-content: space-between;
        margin-bottom: 12px;
    }
    
    .logo {
        margin-right: 0;
    }
    
    .logo-text {
        display: none;
    }
    
    .calendar-nav {
        flex-grow: 1;
        justify-content: flex-end;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .lang-switcher {
        order: 1;
    }
    
    .view-switcher {
        order: 2;
        margin-right: 0;
    }
    
    .admin-link {
        order: 3;
    }
    
    .btn-search-cert {
        order: 4;
        width: 100%;
        text-align: center;
        margin-right: 0;
        margin-top: 4px;
    }
    
    .current-month {
        font-size: 16px;
    }
    
    .calendar-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    
    .calendar-day-head {
        display: none;
    }
    
    .calendar-day {
        min-height: auto;
        padding: 12px;
        border-right: none;
    }
    
    .day-number {
        margin: 0 0 8px 0;
        width: auto;
        height: auto;
        border-radius: 0;
        justify-content: flex-start;
    }
    
    .calendar-day.today .day-number {
        background-color: var(--g-blue);
        color: white;
        font-weight: 700;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .calendar-day.other-month {
        display: none;
    }
}

/* Admin Styles */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 14px;
}

.admin-table th, .admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--g-border);
}

.admin-table th {
    background-color: var(--g-gray-light);
    font-weight: 500;
    color: var(--g-text-light);
}

.admin-table tr:hover {
    background-color: var(--g-hover);
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--g-blue);
    color: white;
}

.btn-secondary {
    background-color: white;
    color: var(--g-text);
    border: 1px solid var(--g-border);
}

.btn-secondary:hover {
    background-color: var(--g-hover);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--g-text);
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--g-border);
    border-radius: 4px;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: var(--g-blue);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #ffffff;
    margin: 50px auto;
    padding: 32px;
    border: none;
    width: 90%;
    max-width: 800px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 24px 38px 3px rgba(0,0,0,0.14), 0 9px 46px 8px rgba(0,0,0,0.12), 0 11px 15px -7px rgba(0,0,0,0.2);
}

.close {
    color: var(--g-text-light);
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    font-weight: 400;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close:hover {
    background-color: var(--g-hover);
    color: var(--g-text);
}

/* Month Selector Popup */
.month-selector-trigger {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
}

.month-selector-trigger:hover {
    background-color: var(--g-hover);
}

.month-selector-trigger svg {
    width: 18px;
    height: 18px;
    margin-left: 4px;
    fill: var(--g-text-light);
}

.month-selector-popup {
    display: none;
    position: absolute;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
    padding: 16px;
    z-index: 2100;
    border: 1px solid var(--g-border);
    width: 240px;
}

.month-selector-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.month-selector-form select {
    padding: 8px;
    border: 1px solid var(--g-border);
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
}

.month-selector-form .btn-go {
    background-color: var(--g-blue);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.month-selector-form .btn-go:hover {
    filter: brightness(0.9);
}
