/* Google Calendar Widget - Base Styles */

.gcw-container {
    --gcw-border-color: #e0e0e0;
    --gcw-bg-color: #fff;
    --gcw-text-color: inherit;
    --gcw-text-muted: #666;
    --gcw-today-bg: #e8f0fe;
    --gcw-hover-bg: #f5f5f5;
    --gcw-radius: 4px;

    font-family: inherit;
    color: var(--gcw-text-color);
    max-width: 100%;
}

.gcw-container *,
.gcw-container *::before,
.gcw-container *::after {
    box-sizing: border-box;
}

/* Controls - Search & Filter */
.gcw-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.gcw-search {
    flex: 1;
    min-width: 200px;
}

.gcw-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gcw-border-color);
    border-radius: var(--gcw-radius);
    font-family: inherit;
    font-size: inherit;
}

.gcw-search-input:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.gcw-filter {
    min-width: 150px;
}

.gcw-filter-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gcw-border-color);
    border-radius: var(--gcw-radius);
    font-family: inherit;
    font-size: inherit;
    background-color: var(--gcw-bg-color);
    cursor: pointer;
}

.gcw-filter-select:focus {
    outline: none;
    border-color: #4285f4;
}

/* Calendar Wrapper */
.gcw-calendar-wrapper {
    position: relative;
    background: var(--gcw-bg-color);
    border: 1px solid var(--gcw-border-color);
    border-radius: var(--gcw-radius);
    overflow: hidden;
}

/* Navigation */
.gcw-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gcw-border-color);
}

/* Button Base Styles */
.gcw-btn-primary,
.gcw-btn-secondary {
    font-size: 15px;
    font-weight: 600;
    border-radius: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s, background-color 0.2s;
}

.gcw-btn-primary {
    color: #EA560D;
    border: 2px solid #EA560D;
    background: transparent;
}

.gcw-btn-primary:hover {
    background: #EA560D;
    color: #fff;
}

.gcw-btn-secondary {
    color: #C9BBDD;
    border: 2px solid #C9BBDD;
    background: transparent;
}

.gcw-btn-secondary:hover {
    background: #C9BBDD;
    color: #fff;
}

.gcw-nav-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: #C9BBDD;
    border: 2px solid #C9BBDD;
    border-radius: 15px;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    vertical-align: middle;
}

.gcw-nav-btn svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
}

.gcw-nav-btn:hover {
    background: #C9BBDD;
    color: #fff;
}

.gcw-nav-center {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gcw-current-period {
    font-weight: 600;
    font-size: 1.1rem;
}

.gcw-today-btn {
    padding: 0.5rem 1.25rem;
    font-size: 15px;
    font-weight: 600;
    border-radius: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #EA560D;
    border: 2px solid #EA560D;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.gcw-today-btn:hover {
    background: #EA560D;
    color: #fff;
}

/* View Toggle (hidden for now) */
.gcw-view-toggle {
    display: none;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--gcw-border-color);
}

.gcw-view-btn {
    padding: 0.5rem 1.25rem;
    font-size: 15px;
    font-weight: 600;
    border-radius: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #C9BBDD;
    border: 2px solid #C9BBDD;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.gcw-view-btn:hover {
    background: #C9BBDD;
    color: #fff;
}

.gcw-view-btn.active {
    background: #C9BBDD;
    border-color: #C9BBDD;
    color: #fff;
}

/* Calendar Grid */
.gcw-calendar {
    overflow: hidden;
}

.gcw-calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 1px solid var(--gcw-border-color);
}

.gcw-header-cell {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--gcw-text-muted);
}

.gcw-calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.gcw-calendar-body.gcw-month-view {
    grid-auto-rows: minmax(80px, auto);
}

.gcw-calendar-body.gcw-week-view {
    grid-auto-rows: minmax(120px, auto);
}

.gcw-day-cell {
    border-right: 1px solid var(--gcw-border-color);
    border-bottom: 1px solid var(--gcw-border-color);
    padding: 0.25rem;
    min-height: 80px;
    min-width: 0;
    overflow: hidden;
}

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

.gcw-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    border-radius: 50%;
}

.gcw-today .gcw-day-number {
    background: #4285f4;
    color: #fff;
    font-weight: 600;
}

.gcw-other-month {
    background: #fafafa;
}

.gcw-other-month .gcw-day-number {
    color: #bbb;
}

/* Events in Calendar */
.gcw-day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.gcw-event {
    padding: 2px 4px;
    font-size: 0.75rem;
    border-radius: 2px;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    color: #fff;
    border-left: 3px solid transparent;
    transition: transform 0.1s, box-shadow 0.1s;
}

.gcw-event:hover {
    transform: translateX(2px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.gcw-event-time {
    font-weight: 600;
    margin-right: 4px;
}

.gcw-event-title {
    font-weight: 400;
}

/* Loading State */
.gcw-loading {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--gcw-text-muted);
    z-index: 10;
}

.gcw-error {
    padding: 2rem;
    text-align: center;
    color: #d93025;
    grid-column: 1 / -1;
}

/* Event List */
.gcw-event-list {
    margin-top: 1.5rem;
}

.gcw-list-title {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.gcw-list-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gcw-list-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--gcw-bg-color);
    border: 1px solid var(--gcw-border-color);
    border-radius: var(--gcw-radius);
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.gcw-list-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gcw-list-item-color {
    width: 4px;
    min-height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
}

.gcw-list-item-content {
    flex: 1;
    min-width: 0;
}

.gcw-list-item-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.gcw-list-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gcw-text-muted);
}

.gcw-list-item-category {
    padding: 0.125rem 0.5rem;
    background: #f0f0f0;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.gcw-no-events {
    padding: 2rem;
    text-align: center;
    color: var(--gcw-text-muted);
    background: #fafafa;
    border-radius: var(--gcw-radius);
}

/* Popup */
.gcw-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.gcw-popup.active {
    display: flex;
}

.gcw-popup-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: var(--gcw-bg-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    animation: gcw-popup-in 0.2s ease-out;
}

@keyframes gcw-popup-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gcw-popup-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--gcw-text-muted);
    border-radius: 50%;
    transition: background-color 0.2s;
    z-index: 1;
    padding: 0;
}

.gcw-popup-close svg {
    display: block;
}

.gcw-popup-close:hover {
    background: var(--gcw-hover-bg);
}

.gcw-popup-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 90vh;
}

.gcw-popup-header {
    border-left: 4px solid;
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.gcw-popup-title {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    font-weight: 600;
    padding-right: 2rem;
}

.gcw-popup-category {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: #f0f0f0;
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--gcw-text-muted);
}

.gcw-popup-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gcw-popup-datetime,
.gcw-popup-location {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    color: var(--gcw-text-muted);
    font-size: 0.875rem;
}

.gcw-popup-datetime svg,
.gcw-popup-location svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.gcw-popup-description {
    padding-top: 0.75rem;
    border-top: 1px solid var(--gcw-border-color);
    line-height: 1.6;
}

.gcw-popup-description a {
    color: #4285f4;
    word-break: break-all;
}

.gcw-popup-description a:hover {
    text-decoration: underline;
}

/* HTML content styling in descriptions */
.gcw-popup-description p {
    margin: 0 0 0.75rem;
}

.gcw-popup-description p:last-child {
    margin-bottom: 0;
}

.gcw-popup-description ul,
.gcw-popup-description ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.gcw-popup-description li {
    margin-bottom: 0.25rem;
}

.gcw-popup-description b,
.gcw-popup-description strong {
    font-weight: 600;
}

.gcw-popup-description i,
.gcw-popup-description em {
    font-style: italic;
}

.gcw-popup-description u {
    text-decoration: underline;
}

.gcw-popup-description h1,
.gcw-popup-description h2,
.gcw-popup-description h3,
.gcw-popup-description h4,
.gcw-popup-description h5,
.gcw-popup-description h6 {
    margin: 0.75rem 0 0.5rem;
    font-weight: 600;
    line-height: 1.3;
}

.gcw-popup-description h1:first-child,
.gcw-popup-description h2:first-child,
.gcw-popup-description h3:first-child,
.gcw-popup-description h4:first-child,
.gcw-popup-description h5:first-child,
.gcw-popup-description h6:first-child {
    margin-top: 0;
}

.gcw-popup-description h1 { font-size: 1.25rem; }
.gcw-popup-description h2 { font-size: 1.15rem; }
.gcw-popup-description h3 { font-size: 1.05rem; }
.gcw-popup-description h4,
.gcw-popup-description h5,
.gcw-popup-description h6 { font-size: 1rem; }

.gcw-popup-description blockquote {
    margin: 0.5rem 0;
    padding: 0.5rem 1rem;
    border-left: 3px solid var(--gcw-border-color);
    background: #f8f9fa;
    color: var(--gcw-text-muted);
}

.gcw-popup-description pre,
.gcw-popup-description code {
    font-family: monospace;
    font-size: 0.875em;
    background: #f5f5f5;
    border-radius: 3px;
}

.gcw-popup-description code {
    padding: 0.125rem 0.25rem;
}

.gcw-popup-description pre {
    padding: 0.75rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.gcw-popup-description pre code {
    padding: 0;
    background: transparent;
}

.gcw-popup-description hr {
    border: none;
    border-top: 1px solid var(--gcw-border-color);
    margin: 0.75rem 0;
}

.gcw-popup-description table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.875rem;
}

.gcw-popup-description th,
.gcw-popup-description td {
    padding: 0.5rem;
    border: 1px solid var(--gcw-border-color);
    text-align: left;
}

.gcw-popup-description th {
    background: #f8f9fa;
    font-weight: 600;
}

.gcw-popup-link {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.5rem 1.25rem;
    font-size: 15px;
    font-weight: 600;
    border-radius: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #EA560D;
    border: 2px solid #EA560D;
    background: transparent;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.gcw-popup-link:hover {
    background: #EA560D;
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .gcw-controls {
        flex-direction: column;
    }

    .gcw-search,
    .gcw-filter {
        min-width: 100%;
    }

    .gcw-nav {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .gcw-nav-btn.gcw-prev {
        grid-column: 1;
        grid-row: 1;
    }

    .gcw-nav-btn.gcw-next {
        grid-column: 3;
        grid-row: 1;
    }

    .gcw-nav-center {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .gcw-current-period {
        font-size: 1.1rem;
    }

    .gcw-today-btn {
        padding: 0.375rem 1rem;
        font-size: 13px;
    }

    .gcw-header-cell {
        padding: 0.5rem 0.25rem;
        font-size: 0.7rem;
    }

    .gcw-calendar-body.gcw-month-view {
        grid-auto-rows: minmax(70px, auto);
    }

    .gcw-day-cell {
        padding: 0.25rem;
        min-height: 70px;
    }

    .gcw-day-number {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
    }

    .gcw-event {
        font-size: 0.65rem;
        padding: 2px 3px;
    }

    .gcw-event-time {
        display: none;
    }

    .gcw-popup-content {
        max-height: 85vh;
        margin: 0.5rem;
    }

    .gcw-popup-body {
        padding: 1rem;
        max-height: 85vh;
    }

    .gcw-popup-title {
        font-size: 1.1rem;
        padding-right: 2.5rem;
    }

    .gcw-list-title {
        font-size: 1.1rem;
    }

    .gcw-list-item {
        padding: 0.75rem;
    }

    .gcw-list-item-title {
        font-size: 1rem;
    }

    .gcw-list-item-meta {
        flex-direction: column;
        gap: 0.25rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .gcw-view-toggle {
        width: 100%;
    }

    .gcw-view-btn {
        flex: 1;
    }

    .gcw-nav-btn {
        width: 36px;
        height: 36px;
    }

    .gcw-calendar-body.gcw-month-view {
        grid-auto-rows: minmax(60px, auto);
    }

    .gcw-day-cell {
        min-height: 60px;
        padding: 0.125rem;
    }

    .gcw-day-number {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }

    .gcw-event {
        font-size: 0.6rem;
        padding: 1px 2px;
        border-radius: 2px;
    }

    .gcw-today-btn {
        padding: 0.25rem 0.75rem;
        font-size: 12px;
        letter-spacing: 1px;
    }
}
