@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --swa-gm-bg: #f8f9fa;
    --swa-gm-card: #ffffff;
    --swa-gm-border: #eef1f4;
    --swa-gm-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.04), 0 4px 12px -2px rgba(0, 0, 0, 0.03);
    --swa-gm-shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
    --swa-gm-text: #1a1d23;
    --swa-gm-text-secondary: #6b7280;
    --swa-gm-text-muted: #9ca3af;
    --swa-gm-primary: #3b82f6;
    --swa-gm-success: #10b981;
    --swa-gm-danger: #ef4444;
    --swa-gm-warning: #f59e0b;
    --swa-gm-radius: 12px;
    --swa-gm-radius-sm: 8px;
    --swa-gm-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Dashboard ---------- */

.swa-gm-dashboard *,
.swa-gm-widget * {
    box-sizing: border-box;
}

.swa-gm-dashboard {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--swa-gm-bg);
    padding: 32px 24px;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    color: var(--swa-gm-text);
    -webkit-font-smoothing: antialiased;
    float: none;
    clear: both;
}

.swa-gm-current {
    background: var(--swa-gm-card);
    border-radius: var(--swa-gm-radius);
    border: 1px solid var(--swa-gm-border);
    box-shadow: var(--swa-gm-shadow);
    padding: 24px;
    margin-bottom: 24px;
    animation: swaGmSlideUp 0.5s ease-out both;
}

.swa-gm-current__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.swa-gm-current__title {
    font-size: 22px !important;
    font-weight: 700;
    margin: 0;
    color: var(--swa-gm-text);
    letter-spacing: -0.01em;
}

.swa-gm-current__status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    color: var(--swa-gm-text-secondary);
    white-space: nowrap;
}

.swa-gm-current__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.swa-gm-current__empty {
    color: var(--swa-gm-text-muted);
    font-size: 14px;
    margin: 0 0 20px;
}

.swa-gm-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.swa-gm-section {
    background: var(--swa-gm-card);
    border-radius: var(--swa-gm-radius);
    border: 1px solid var(--swa-gm-border);
    box-shadow: var(--swa-gm-shadow);
    padding: 24px;
    transition: box-shadow var(--swa-gm-transition);
    animation: swaGmSlideUp 0.5s ease-out both;
    min-width: 0;
    overflow: visible;
}

.swa-gm-section:nth-child(1) { animation-delay: 0.05s; }
.swa-gm-section:nth-child(2) { animation-delay: 0.1s; }
.swa-gm-section:nth-child(3) { animation-delay: 0.15s; }
.swa-gm-section:nth-child(4) { animation-delay: 0.2s; }

.swa-gm-section:hover {
    box-shadow: var(--swa-gm-shadow-lg);
}

.swa-gm-section__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.swa-gm-section__title {
    font-size: 18px !important;
    font-weight: 700;
    margin: 0 0 2px;
    color: var(--swa-gm-text);
    letter-spacing: -0.01em;
}

.swa-gm-section__desc {
    font-size: 12px;
    color: var(--swa-gm-text-muted);
    margin: 0;
}

/* ---------- Kontrole ---------- */

.swa-gm-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.swa-gm-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--swa-gm-card);
    border: 1px solid var(--swa-gm-border);
    border-radius: var(--swa-gm-radius-sm);
    padding: 0 12px;
    transition: border-color var(--swa-gm-transition);
}

.swa-gm-select-wrap:hover {
    border-color: var(--swa-gm-primary);
}

.swa-gm-select-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--swa-gm-text-muted);
    margin-right: 8px;
    white-space: nowrap;
}

.swa-gm-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    padding: 8px 24px 8px 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--swa-gm-text);
    cursor: pointer;
    min-width: 100px;
}

.swa-gm-select:focus {
    outline: none;
}

.swa-gm-select-wrap::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--swa-gm-text-secondary);
    pointer-events: none;
}

.swa-gm-last-updated {
    font-size: 12px;
    color: var(--swa-gm-text-muted);
    margin-left: auto;
    white-space: nowrap;
}

/* ---------- Grafovi ---------- */

.swa-gm-chart-wrap {
    position: relative;
    width: 100%;
    height: 280px;
    max-height: 400px;
    margin-bottom: 20px;
    transition: opacity var(--swa-gm-transition);
}

.swa-gm-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: 400px;
}

.swa-gm-chart-wrap--loading {
    opacity: 0.4;
}

.swa-gm-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border: 3px solid var(--swa-gm-border);
    border-top-color: var(--swa-gm-primary);
    border-radius: 50%;
    animation: swaGmSpin 0.8s linear infinite;
    z-index: 5;
    display: none;
}

.swa-gm-chart-wrap--loading .swa-gm-spinner {
    display: block;
}

.swa-gm-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--swa-gm-text-muted);
}

.swa-gm-empty__icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.swa-gm-empty__text {
    font-size: 14px;
}

/* ---------- Statistika ---------- */

.swa-gm-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.swa-gm-stat {
    background: var(--swa-gm-card);
    border: 1px solid var(--swa-gm-border);
    border-radius: var(--swa-gm-radius-sm);
    text-align: center;
    transition: transform var(--swa-gm-transition), box-shadow var(--swa-gm-transition);
    display: flex;
    flex-direction: column;
}

.swa-gm-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--swa-gm-shadow);
}

.swa-gm-stat__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--swa-gm-text-secondary);
    padding: 10px 12px;
    margin: 0;
    letter-spacing: 0.01em;
    border-bottom: 1px solid var(--swa-gm-border);
}

.swa-gm-stat__value {
    font-size: 24px;
    font-weight: 700;
    color: var(--swa-gm-primary);
    padding: 14px 12px;
    line-height: 1.2;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}

.swa-gm-stat__value--success {
    color: var(--swa-gm-success);
}

.swa-gm-stat__unit {
    font-size: 0.55em;
    font-weight: 600;
    color: inherit;
    opacity: 0.8;
}

.swa-gm-stat__value[data-animate] {
    animation: swaGmCountPop 0.4s ease-out;
}

/* ---------- Kompaktni widget ---------- */

.swa-gm-widget {
    width: 300px;
    background: var(--swa-gm-card, #ffffff);
    color: var(--swa-gm-text, #1a1d23);
    border-radius: var(--swa-gm-radius-sm, 8px);
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--swa-gm-shadow, 0 4px 12px -2px rgba(0, 0, 0, 0.03));
    border: 1px solid var(--swa-gm-border, #eef1f4);
    font-family: 'Inter', -apple-system, sans-serif;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    margin: 8px 0;
    transition: transform var(--swa-gm-transition, 0.3s), box-shadow var(--swa-gm-transition, 0.3s), border-color var(--swa-gm-transition, 0.3s);
    animation: swaGmSlideUp 0.5s ease-out both;
}

.swa-gm-widget:hover {
    transform: translateY(-2px);
    box-shadow: var(--swa-gm-shadow-lg, 0 10px 30px -5px rgba(0, 0, 0, 0.1));
    border-color: var(--swa-gm-primary, #3b82f6);
}

.swa-gm-widget__left {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    flex: 1 1 auto;
    min-width: 0;
}

.swa-gm-widget__meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.swa-gm-widget__station {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    min-width: 0;
}

.swa-gm-widget__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.swa-gm-widget__dot--live {
    background: var(--swa-gm-success, #10b981);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    animation: swaGmPulse 2s infinite;
}

.swa-gm-widget__dot--stale {
    background: var(--swa-gm-warning, #f59e0b);
}

.swa-gm-widget__temp-group {
    display: flex;
    align-items: baseline;
    margin-top: 4px;
}

.swa-gm-widget__temp {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
    letter-spacing: -0.03em;
}

.swa-gm-widget__temp-unit {
    font-size: 16px;
    font-weight: 600;
    color: #3b82f6;
    margin-left: 2px;
}

.swa-gm-widget__time {
    font-size: 11px;
    font-weight: 600;
    color: var(--swa-gm-text-muted, #9ca3af);
    margin-top: 4px;
}

.swa-gm-widget__nodata {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.swa-gm-widget--empty {
    width: auto;
    min-width: 300px;
}

.swa-gm-widget__right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    flex: 0 0 auto;
    border-left: 1px solid var(--swa-gm-border, #eef1f4);
    padding-left: 14px;
    margin-left: 14px;
    height: 100%;
}

.swa-gm-widget__item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.swa-gm-widget__svg {
    width: 14px;
    height: 14px;
    stroke: #64748b;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    transition: stroke 0.3s ease, transform 0.3s ease;
}

.swa-gm-widget:hover .swa-gm-widget__svg {
    stroke: #3b82f6;
}

.swa-gm-widget__item:hover .swa-gm-widget__svg {
    transform: scale(1.15);
}

/* ---------- Animacije ---------- */

@keyframes swaGmSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes swaGmSpin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes swaGmCountPop {
    0% {
        transform: scale(0.85);
        opacity: 0.3;
    }
    60% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes swaGmPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* ---------- Responzivnost ---------- */

@media (max-width: 1024px) {
    .swa-gm-sections {
        grid-template-columns: 1fr;
    }

    .swa-gm-current__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .swa-gm-last-updated {
        margin-left: 0;
    }
}

@media (max-width: 640px) {
    .swa-gm-dashboard {
        padding: 16px 12px;
    }

    .swa-gm-section {
        padding: 16px;
    }

    .swa-gm-section__title {
        font-size: 16px !important;
    }

    .swa-gm-current {
        padding: 16px;
    }

    .swa-gm-current__title {
        font-size: 18px !important;
    }

    .swa-gm-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .swa-gm-stat__value {
        font-size: 20px;
    }

    .swa-gm-chart-wrap {
        height: 220px;
    }
}

