/* Mukautetut värit ja tyylit */
:root {
    /* Päävärit (taustat ja isot pinnat) */
    --color-bg-primary: #f8fafc; /* hyvin vaalea harmaa/sinertävä tausta kevyttä, valoisaa teemaa varten */
    --color-bg-secondary: #ffffff;

    /* Korostus- ja toiminnalliset värit - pehmeä pastellinen violetti */
    --color-accent-hover: #bfa7ff; /* violetti 300–350 alue, pehmeä */
    --color-accent-primary: #c4b5fd; /* tailwind violet-300 */
    --color-accent-primary-hover: #a78bfa; /* tailwind violet-400 */
    --color-warning: #fcd34d;
    --color-success: #9ae6b4;

    /* Tekstivärit */
    --color-text-primary: #1f2937;
    --color-text-secondary: #4b5563;
    --color-text-accent: #7c3aed; /* violetti-600 */
}

/* Page-wide animated gradient background */
html, body {
    min-height: 100%;
    height: 100%;
}
body {
    color: var(--color-text-primary);
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    /* Soft animated gradient across the whole page */
    background: linear-gradient(120deg,
      rgba(196,181,253,0.55) 0%,   /* violet-300 */
      rgba(251,207,232,0.55) 33%,  /* pink-200 */
      rgba(191,219,254,0.55) 66%,  /* sky-200 */
      rgba(199,210,254,0.55) 100%  /* indigo-200 */
    );
    background-size: 300% 300%;
    animation: ticketsGradientMove 12s ease-in-out infinite;
}

/* Nappien tyylit (kompaktimmat) */
/* Yleinen oletusnappi: pastellinsininen */
.btn {
    @apply inline-flex items-center gap-2 px-4 py-2 rounded-md font-medium shadow-sm;
    background-color: #bfdbfe; /* sky-300 */
    color: #0f172a; /* slate-900, hyvä kontrasti pastellille */
    transition: box-shadow 150ms ease, transform 150ms ease;
}
.btn:hover {
    background-color: #93c5fd; /* sky-400 */
    @apply shadow;
}
.btn:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}
.btn:disabled,
.btn.is-disabled,
.btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    @apply shadow-none;
}

/* Säilytetään aiemmat variantit taaksepäinyhteensopivasti */
.btn-primary {
    @apply px-3 py-1.5 rounded-lg text-sm;
    background-color: var(--color-accent-primary);
    color: white;
    transition: all 150ms;
}

.btn-primary:hover {
    background-color: var(--color-accent-primary-hover);
    @apply shadow-sm;
}

.btn-secondary {
    @apply px-3 py-1.5 rounded-lg border text-sm;
    background-color: transparent;
    border-color: var(--color-accent-hover);
    color: var(--color-text-accent);
    transition: all 150ms;
}

.btn-secondary:hover {
    @apply shadow-sm;
    background-color: rgba(167, 139, 250, 0.08); /* pehmeä violetti hover-tausta */
}

/* Vaarallinen toiminto -nappi */
.btn--danger {
    background-color: #ef4444; /* red-500 */
    color: #ffffff;
}
.btn--danger:hover {
    background-color: #dc2626; /* red-600 */
}


/* Kommenttikentän tyylit */
.comment-field {
    background-color: var(--color-bg-secondary);
    @apply border rounded-xl shadow-sm;
    border-color: #d1d5db;
    transition: all 150ms;
}

.comment-field:focus {
    @apply outline-none ring-2;
    border-color: #c084fc;
    ring-color: rgba(192, 132, 252, 0.5);
}

/* Korttityyli */
.task-card {
    @apply p-3 rounded-lg shadow-sm border border-gray-100 bg-white transition-all duration-150;
}

.task-card:hover {
    @apply shadow-sm;
    background-color: #f5f3ff; /* violet-50 */
}

/* Paneelityylit */
.sidebar-panel {
    @apply p-4 rounded-xl;
    background-color: var(--color-bg-secondary);
}

/* Animaatiot */
.success-message {
    animation: fadeInOut 3s ease-in-out forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { opacity: 0; }
}
/* Lisätään priorisointityylit */
.priority-low {
    background-color: #e0e7ff;
    color: #4338ca;
}

.priority-medium {
    background-color: var(--color-accent-hover);
    color: #1e3a8a;
}

.priority-high {
    background-color: var(--color-warning);
    color: #92400e;
}

.priority-urgent {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Statustilojen tyylejä voidaan myös käyttää merkkivärinä */
.status-indicator {
    @apply h-3 w-3 rounded-full;
}

/* Lisätään pienempi merkki prioriteetin merkitsemiseen */
.priority-indicator {
    @apply h-2 w-2 rounded-full inline-block mr-1;
}

/* Parannellaan tehtäväkorttien tyyliä */
.task-card {
    @apply p-3 rounded-lg shadow-sm border border-gray-100 bg-white transition-all duration-150;
}

.task-card:hover {
    @apply shadow-sm;
    transform: translateY(-1px);
    background-color: #f5f3ff; /* violet-50 */
    border-color: var(--color-accent-hover);
}

/* Aktiivisesti suodatettavan kentän korostus */
.filter-active {
    @apply ring-2;
    border-color: var(--color-accent-hover);
    ring-color: rgba(158, 167, 248, 0.5);
}

/* Hakutyökalujen korostus */
.search-tools {
    background-color: var(--color-bg-secondary);
    @apply rounded-xl shadow-sm p-4 mb-6;
}

/* Määräaikojen tyylit */
.due-date-overdue {
    color: #dc2626;
    font-weight: 500;
}

.due-date-today {
    color: var(--color-warning);
    font-weight: 500;
}

.due-date-upcoming {
    color: var(--color-text-secondary);
}
/* Status-indikaattorien tyylit */
.status-queue {
    background-color: #1f2937; /* erittäin tumma harmaa */
}

.status-in-progress {
    background-color: #d97706; /* voimakas oranssi */
    animation: pulse 2s infinite; /* sykkivä efekti */
}

.status-completed {
    background-color: #047857; /* voimakas vihreä */
}

/* Sykkivä animaatio in-progress statukselle */
@keyframes pulse {
  0% {
    opacity: 0.6;
    transform: scale(0.95);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  100% {
    opacity: 0.6;
    transform: scale(0.95);
  }
}

/* Status indicator styling */
.status-indicator {
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    min-width: 16px;
    min-height: 16px;
}

/* Tukipyyntöjen näkymien taustagradientti (violetti → pinkki → sininen), elävämpi ja koko alueen täyttävä */
@keyframes ticketsGradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Glassy surfaces for header and sidebar */
.app__header {
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    backdrop-filter: blur(10px) saturate(120%);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.app__sidebar {
    background: rgba(255, 255, 255, 0.45);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    backdrop-filter: blur(10px) saturate(120%);
    border-right: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.10);
}

/* tickets-gradient no longer needed on main since body has gradient */

/* Modern Form Styles */
.form__container {
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    backdrop-filter: blur(10px) saturate(120%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 60px rgba(124, 58, 237, 0.15), 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 1rem;
    padding: 2rem;
    transition: all 300ms ease;
}

.form__container:hover {
    box-shadow: 0 25px 80px rgba(124, 58, 237, 0.2), 0 15px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.form__field {
    margin-bottom: 1.5rem;
}

.form__field:last-child {
    margin-bottom: 0;
}

.form__label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.025em;
}

.form__input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid rgba(196, 181, 253, 0.3);
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    color: var(--color-text-primary);
    transition: all 200ms ease;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.05);
}

.form__input:focus {
    outline: none;
    border-color: var(--color-accent-primary);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.2), 0 4px 16px rgba(124, 58, 237, 0.1);
    transform: translateY(-1px);
}

.form__input:focus + .form__help {
    color: var(--color-text-accent);
}

.form__input:valid {
    border-color: rgba(34, 197, 94, 0.4);
}

.form__input:valid:not(:focus) {
    background: rgba(240, 253, 244, 0.5);
}

.form__input:hover {
    border-color: rgba(196, 181, 253, 0.5);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.08);
}

.form__input[aria-invalid="true"] {
    border-color: #ef4444;
    background: rgba(254, 242, 242, 0.9);
}

.form__input[aria-invalid="true"]:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1), 0 4px 16px rgba(239, 68, 68, 0.1);
}

.form__help {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 0.375rem;
    line-height: 1.4;
}

.form__error {
    font-size: 0.875rem;
    color: #dc2626;
    margin-top: 0.375rem;
    font-weight: 500;
}

.form__grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .form__grid--two-cols {
        grid-template-columns: 1fr 1fr;
    }
}

.form__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(196, 181, 253, 0.15);
}

@media (max-width: 640px) {
    .form__actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    
    .form__actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Enhanced alert styles */
.alert {
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
    font-size: 0.875rem;
    line-height: 1.5;
}

.alert--error {
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.95), rgba(252, 231, 243, 0.95));
    border-color: rgba(239, 68, 68, 0.2);
    color: #991b1b;
}

.alert--error .alert__title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #dc2626;
}

.alert--error ul {
    margin: 0;
    padding-left: 1.125rem;
    list-style-type: disc;
}

/* Enhanced button styles */
.btn--primary {
    background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-primary-hover));
    color: white;
    border: none;
    font-weight: 600;
    padding: 0.875rem 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
    transition: box-shadow 200ms ease, transform 200ms ease;
}

.btn--primary:hover {
    background: linear-gradient(135deg, var(--color-accent-primary-hover), #8b5cf6);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
    transform: translateY(-1px);
}

.btn--primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.btn--primary[disabled] {
    background: linear-gradient(135deg, #d1d5db, #9ca3af);
    color: #6b7280;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn--secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-text-primary);
    border: 2px solid rgba(196, 181, 253, 0.3);
    font-weight: 500;
    padding: 0.75rem 1.75rem;
    border-radius: 0.75rem;
    transition: box-shadow 200ms ease, transform 200ms ease, border-color 200ms ease;
}

.btn--secondary:hover {
    background: rgba(255, 255, 255, 1);
    border-color: var(--color-accent-primary);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.1);
    transform: translateY(-1px);
}

/* Page header improvements */
.page__header {
    margin-bottom: 2rem;
}

.page__header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
    background: linear-gradient(135deg, var(--color-text-primary), var(--color-text-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Subscribers List Styling */
.subscriber__card {
    transition: all 200ms ease;
}

.subscriber__card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.15);
    border-color: rgba(196, 181, 253, 0.4);
}

.subscribers__toolbar {
    position: sticky;
    top: 1rem;
    z-index: 10;
}

.subscribers__filters {
    display: grid;
    gap: 1rem;
}

@media (max-width: 768px) {
    .subscribers__filters > div {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .subscribers__stats {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .stats__cards {
        order: 2;
        flex-direction: column;
    }
    
    .subscriber__card {
        padding: 1rem;
    }
    
    .subscriber__card > div {
        flex-direction: column;
        gap: 1rem;
    }
    
    .subscriber__actions {
        margin-left: 0 !important;
        justify-content: flex-end;
    }
}

/* Tag badges */
.tag__badge {
    position: relative;
    overflow: hidden;
}

.tag__badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.tag__badge:hover::before {
    left: 100%;
}

/* Source badges */
.source__badge--manual {
    border-left: 3px solid var(--color-text-accent);
}

.source__badge--form {
    border-left: 3px solid #059669;
}

.source__badge--import {
    border-left: 3px solid #d97706;
}

/* Stats cards animation */
.stats__card {
    transition: all 200ms ease;
}

.stats__card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.1);
}

/* Tag selector styling */
.tag__checkbox {
    transition: all 200ms ease;
}

.tag__checkbox:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.15);
}

/* Enhanced styling for checked state handled inline via ERB */

.tags__selector:focus-within {
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.2);
}