/**
 * IHKAAS Event Plugin - Frontend Styles
 * File: assets/css/frontend-style.css
 * Version: 1.0.0
 * 
 * Dark theme with gold accents
 * Primary BG: #1e1e1e
 * Accent: #aa6a25
 * Hover: #efc75e
 */

/* ========================================
   CSS VARIABLES
======================================== */
:root {
    --ihkaas-bg: #1e1e1e;
    --ihkaas-overlay: #383838;
    --ihkaas-text: #ffffff;
    --ihkaas-accent: #aa6a25;
    --ihkaas-hover: #efc75e;
    --ihkaas-muted: #bfbfbf;
    --ihkaas-border: #efc75e;
    --ihkaas-success: #4caf50;
    --ihkaas-error: #ff5252;
    --ihkaas-warning: #ff9800;
    --ihkaas-info: #2196f3;
}

/* ========================================
   EVENT GRID
======================================== */
.ihkaas-event-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

/* ========================================
   EVENT CARD
======================================== */
.ihkaas-event-card {
    background: var(--ihkaas-overlay);
    border: 2px solid var(--ihkaas-accent);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ihkaas-event-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(239, 199, 94, 0.3);
    border-color: var(--ihkaas-hover);
}

.ihkaas-event-image-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--ihkaas-accent) 0%, var(--ihkaas-hover) 100%);
}

.ihkaas-event-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ihkaas-event-card:hover .ihkaas-event-image {
    transform: scale(1.1);
}

.ihkaas-event-type-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    color: var(--ihkaas-hover);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid var(--ihkaas-hover);
}

.ihkaas-event-type-badge.paid {
    color: var(--ihkaas-hover);
    border-color: var(--ihkaas-hover);
}

.ihkaas-event-type-badge.free {
    color: var(--ihkaas-success);
    border-color: var(--ihkaas-success);
}

.ihkaas-event-content {
    padding: 25px;
}

.ihkaas-event-title {
    color: var(--ihkaas-hover);
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 15px 0;
    line-height: 1.3;
}

.ihkaas-event-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.ihkaas-event-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ihkaas-muted);
    font-size: 13px;
}

.ihkaas-event-meta-icon {
    color: var(--ihkaas-accent);
    font-size: 16px;
}

.ihkaas-event-description {
    color: var(--ihkaas-text);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ihkaas-event-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid rgba(239, 199, 94, 0.2);
}

.ihkaas-event-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--ihkaas-hover);
}

.ihkaas-event-price.free {
    color: var(--ihkaas-success);
}

/* ========================================
   LIVE INDICATOR
======================================== */
.ihkaas-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(76, 175, 80, 0.15);
    border-radius: 25px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ihkaas-success);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ihkaas-live-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--ihkaas-success);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--ihkaas-success);
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.4);
        opacity: 0.5;
    }
}

.ihkaas-live-indicator.ihkaas-offline {
    background: rgba(255, 82, 82, 0.15);
    color: var(--ihkaas-error);
}

.ihkaas-live-indicator.ihkaas-offline .ihkaas-live-dot {
    background-color: var(--ihkaas-error);
    box-shadow: 0 0 15px var(--ihkaas-error);
    animation: none;
}

/* ========================================
   BUTTONS
======================================== */
.ihkaas-btn {
    background-color: var(--ihkaas-accent);
    color: #000;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    line-height: 1.5;
}

.ihkaas-btn:hover {
    background-color: var(--ihkaas-hover);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 199, 94, 0.4);
}

.ihkaas-btn:active {
    transform: translateY(0);
}

.ihkaas-btn-secondary {
    background-color: transparent;
    border: 2px solid var(--ihkaas-accent);
    color: var(--ihkaas-accent);
}

.ihkaas-btn-secondary:hover {
    background-color: var(--ihkaas-accent);
    color: #000;
}

.ihkaas-readmore {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.ihkaas-readmore:hover {
    color: #fff;
}

/* ========================================
   POPUP/MODAL
======================================== */
.ihkaas-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 999998;
    display: none;
    backdrop-filter: blur(5px);
}

.ihkaas-popup-overlay.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.ihkaas-detail-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--ihkaas-overlay);
    border: 3px solid var(--ihkaas-accent);
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 999999;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ihkaas-detail-popup.active {
    display: block;
    animation: slideUp 0.3s ease;
}

.ihkaas-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid var(--ihkaas-accent);
    background: linear-gradient(135deg, rgba(170, 106, 37, 0.1) 0%, rgba(239, 199, 94, 0.1) 100%);
}

.ihkaas-popup-header h2 {
    margin: 0;
    color: var(--ihkaas-hover);
    font-size: 28px;
    font-weight: 700;
}

.ihkaas-popup-close {
    background: transparent;
    border: none;
    color: var(--ihkaas-hover);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    transition: all 0.3s ease;
}

.ihkaas-popup-close:hover {
    color: var(--ihkaas-error);
    transform: scale(1.1);
}

.ihkaas-popup-body {
    padding: 30px;
}

.ihkaas-popup-image {
    width: 100%;
    margin-bottom: 25px;
    border-radius: 8px;
    overflow: hidden;
}

.ihkaas-popup-image img {
    width: 100%;
    height: auto;
    display: block;
}

.ihkaas-popup-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.ihkaas-popup-meta-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ihkaas-popup-meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ihkaas-muted);
    font-weight: 600;
}

.ihkaas-popup-meta-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--ihkaas-hover);
}

.ihkaas-popup-desc {
    color: var(--ihkaas-text);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 25px;
}

.ihkaas-popup-desc h1,
.ihkaas-popup-desc h2,
.ihkaas-popup-desc h3 {
    color: var(--ihkaas-hover);
    margin-top: 20px;
    margin-bottom: 10px;
}

.ihkaas-popup-desc p {
    margin-bottom: 15px;
}

.ihkaas-popup-desc ul,
.ihkaas-popup-desc ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.ihkaas-popup-footer {
    padding: 20px 30px;
    border-top: 2px solid rgba(239, 199, 94, 0.2);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: rgba(0, 0, 0, 0.2);
}

/* ========================================
   REGISTRATION FORM IN POPUP
======================================== */
.ihkaas-register-form {
    background: rgba(0, 0, 0, 0.3);
    padding: 25px;
    border-radius: 8px;
    margin-top: 20px;
}

.ihkaas-register-form h3 {
    color: var(--ihkaas-hover);
    margin-top: 0;
    margin-bottom: 20px;
}

.ihkaas-form-group {
    margin-bottom: 20px;
}

.ihkaas-form-label {
    display: block;
    color: var(--ihkaas-hover);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

/* Email validation colors */
.ihkaas-form-input[type="email"]:invalid:not(:placeholder-shown) {
    border-color: var(--ihkaas-error);
    color: var(--ihkaas-error);
}

.ihkaas-form-input[type="email"]:valid {
    border-color: var(--ihkaas-success);
    color: var(--ihkaas-text);
}

/* Placeholder color */
.ihkaas-form-input::placeholder,
.ihkaas-form-textarea::placeholder {
    color: var(--ihkaas-muted);
    opacity: 0.6;
}

.ihkaas-form-input,
.ihkaas-form-select,
.ihkaas-form-textarea {
    width: 100%;
    padding: 12px 15px;
    background: var(--ihkaas-bg);
    border: 1px solid var(--ihkaas-accent);
    border-radius: 6px;
    color: var(--ihkaas-text);
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.ihkaas-form-input:focus,
.ihkaas-form-select:focus,
.ihkaas-form-textarea:focus {
    outline: none;
    border-color: var(--ihkaas-hover);
    box-shadow: 0 0 0 3px rgba(239, 199, 94, 0.15);
}

.ihkaas-form-input::placeholder {
    color: var(--ihkaas-muted);
    opacity: 0.7;
}

/* ========================================
   SUBSCRIBE FORM
======================================== */
.ihkaas-subscribe-wrapper {
    background: var(--ihkaas-overlay);
    border: 2px solid var(--ihkaas-accent);
    border-radius: 12px;
    padding: 40px;
    max-width: 600px;
    margin: 30px auto;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ihkaas-subscribe-wrapper h2 {
    color: var(--ihkaas-hover);
    font-size: 28px;
    margin: 0 0 10px 0;
}

.ihkaas-subscribe-wrapper p {
    color: var(--ihkaas-muted);
    font-size: 16px;
    margin-bottom: 30px;
}

.ihkaas-subscribe-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ihkaas-subscribe-form .ihkaas-form-group {
    text-align: left;
}

/* ========================================
   NOTICES/ALERTS
======================================== */
.ihkaas-notice {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.ihkaas-notice-success {
    background: rgba(76, 175, 80, 0.15);
    border: 2px solid var(--ihkaas-success);
    color: var(--ihkaas-success);
}

.ihkaas-notice-error {
    background: rgba(255, 82, 82, 0.15);
    border: 2px solid var(--ihkaas-error);
    color: var(--ihkaas-error);
}

.ihkaas-notice-warning {
    background: rgba(255, 152, 0, 0.15);
    border: 2px solid var(--ihkaas-warning);
    color: var(--ihkaas-warning);
}

.ihkaas-notice-info {
    background: rgba(33, 150, 243, 0.15);
    border: 2px solid var(--ihkaas-info);
    color: var(--ihkaas-info);
}

/* ========================================
   LOADING SPINNER
======================================== */
.ihkaas-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.ihkaas-spinner {
    border: 4px solid rgba(239, 199, 94, 0.2);
    border-top: 4px solid var(--ihkaas-hover);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

/* ========================================
   CALENDAR WRAPPER
======================================== */
.ihkaas-calendar-wrapper {
    background: var(--ihkaas-overlay);
    padding: 30px;
    border-radius: 12px;
    border: 2px solid var(--ihkaas-accent);
    margin: 30px 0;
}

/* Override FullCalendar styles for dark theme */
.ihkaas-calendar-wrapper .fc {
    color: var(--ihkaas-text);
}

.ihkaas-calendar-wrapper .fc-toolbar-title {
    color: var(--ihkaas-hover) !important;
}

.ihkaas-calendar-wrapper .fc-button {
    background-color: var(--ihkaas-accent) !important;
    border-color: var(--ihkaas-accent) !important;
    color: #000 !important;
}

.ihkaas-calendar-wrapper .fc-button:hover {
    background-color: var(--ihkaas-hover) !important;
    color: #fff !important;
}

.ihkaas-calendar-wrapper .fc-button-active {
    background-color: var(--ihkaas-hover) !important;
}

.ihkaas-calendar-wrapper .fc-daygrid-day {
    background: var(--ihkaas-bg);
}

.ihkaas-calendar-wrapper .fc-daygrid-day:hover {
    background: rgba(239, 199, 94, 0.1);
}

.ihkaas-calendar-wrapper .fc-event {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 5px;
}

/* ========================================
   EMPTY STATE
======================================== */
.ihkaas-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--ihkaas-muted);
}

.ihkaas-empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.ihkaas-empty-state h3 {
    color: var(--ihkaas-hover);
    font-size: 24px;
    margin-bottom: 10px;
}

.ihkaas-empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* ========================================
   ANIMATIONS
======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   ACCESSIBILITY
======================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for accessibility */
.ihkaas-btn:focus,
.ihkaas-form-input:focus,
.ihkaas-form-select:focus,
.ihkaas-form-textarea:focus,
.ihkaas-popup-close:focus {
    outline: 2px solid var(--ihkaas-hover);
    outline-offset: 2px;
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */
@media (max-width: 768px) {
    .ihkaas-event-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .ihkaas-detail-popup {
        width: 95%;
        max-height: 95vh;
    }

    .ihkaas-popup-header {
        padding: 20px;
    }

    .ihkaas-popup-header h2 {
        font-size: 22px;
    }

    .ihkaas-popup-body {
        padding: 20px;
    }

    .ihkaas-popup-meta {
        grid-template-columns: 1fr;
    }

    .ihkaas-popup-footer {
        flex-direction: column;
    }

    .ihkaas-popup-footer .ihkaas-btn {
        width: 100%;
    }

    .ihkaas-subscribe-wrapper {
        padding: 30px 20px;
    }

    .ihkaas-event-footer {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .ihkaas-popup-header h2 {
        font-size: 18px;
    }

    .ihkaas-event-title {
        font-size: 18px;
    }

    .ihkaas-event-content {
        padding: 20px;
    }

    .ihkaas-btn {
        width: 100%;
        padding: 12px;
        text-align: center;
    }

    .ihkaas-subscribe-wrapper h2 {
        font-size: 24px;
    }

    .ihkaas-calendar-wrapper {
        padding: 15px;
    }

    .ihkaas-event-image-wrapper {
        height: 180px;
    }
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {
    .ihkaas-popup-overlay,
    .ihkaas-btn,
    .ihkaas-popup-close {
        display: none !important;
    }

    .ihkaas-detail-popup {
        position: static;
        transform: none;
        max-width: 100%;
        border: none;
    }
}

/* ========================================
   RTL SUPPORT
======================================== */
[dir="rtl"] .ihkaas-event-meta-icon {
    margin-left: 8px;
    margin-right: 0;
}

[dir="rtl"] .ihkaas-live-indicator {
    flex-direction: row-reverse;
}

/* ========================================
   DARK MODE ENHANCEMENTS
======================================== */
@media (prefers-color-scheme: dark) {
    /* Already dark by default, but can add overrides if needed */
}

/* ========================================
   HIGH CONTRAST MODE
======================================== */
@media (prefers-contrast: high) {
    .ihkaas-event-card {
        border-width: 3px;
    }

    .ihkaas-btn {
        border: 2px solid #000;
    }

    .ihkaas-form-input,
    .ihkaas-form-select,
    .ihkaas-form-textarea {
        border-width: 2px;
    }
}

/* ========================================
   REDUCED MOTION
======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .ihkaas-live-dot {
        animation: none;
    }

    .ihkaas-event-card:hover {
        transform: none;
    }

    .ihkaas-popup-close:hover {
        transform: none;
    }
}


/* ========================================
   EMAIL VALIDATION & FORM INPUT COLORS
======================================== */

/* Email validation - RED for invalid */
.ihkaas-form-input[type="email"]:invalid:not(:placeholder-shown) {
    border-color: var(--ihkaas-error) !important;
    color: var(--ihkaas-error) !important;
}

/* Email validation - WHITE for valid */
.ihkaas-form-input[type="email"]:valid:not(:placeholder-shown) {
    border-color: var(--ihkaas-success) !important;
    color: #ffffff !important;
}

/* All input text should be WHITE */
.ihkaas-form-input,
.ihkaas-form-select,
.ihkaas-form-textarea {
    color: #ffffff !important;
}

/* Placeholder text color - GRAY */
.ihkaas-form-input::placeholder,
.ihkaas-form-select::placeholder,
.ihkaas-form-textarea::placeholder {
    color: var(--ihkaas-muted) !important;
    opacity: 0.6;
}

/* Autofill background fix for dark theme */
.ihkaas-form-input:-webkit-autofill,
.ihkaas-form-input:-webkit-autofill:hover,
.ihkaas-form-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--ihkaas-overlay) inset !important;
    -webkit-text-fill-color: #ffffff !important;
    border-color: var(--ihkaas-accent) !important;
}