/* widget.css - Chat Widget Styles - Zmodernizowany design zgodny ze stroną główną */

/* Reset dla widgetu */
#korkiai-chat-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  }
  
  /* Launcher - przycisk otwierający chat */
  #korkiai-chat-launcher {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #563FC5 0%, #745EE0 100%);
    color: white;
    border: 3px solid rgba(255, 255, 255, 0.9);
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(86, 63, 197, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Plus Jakarta Sans', sans-serif;
    backdrop-filter: blur(10px);
  }
  
  #korkiai-chat-launcher:hover {
    transform: translateY(-4px) scale(1.05);
    background: linear-gradient(135deg, #644FCA 0%, #563FC5 100%);
    box-shadow: 0 12px 40px rgba(86, 63, 197, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2);
  }
  
  #korkiai-chat-launcher svg {
    width: 26px;
    height: 26px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  }
  
  #korkiai-chat-launcher.hidden {
    opacity: 0;
    pointer-events: none;
  }
  
  /* Kontener chatu */
  #korkiai-chat-container {
    position: fixed;
    bottom: 100px;
    left: 24px;
    width: 420px;
    max-width: calc(100vw - 48px);
    height: 680px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid rgba(86, 63, 197, 0.1);
    box-shadow: 0 24px 80px rgba(86, 63, 197, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    transform: translate3d(0, 20px, 0) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    backdrop-filter: blur(20px);
  }
  
  #korkiai-chat-container.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
  }
  
  /* Header */
  .korkiai-chat-header {
    background: linear-gradient(135deg, #563FC5 0%, #745EE0 100%);
    color: #ffffff;
    padding: 20px 24px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
  }

  .korkiai-chat-header-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  
  .korkiai-chat-header-content h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: -0.01em;
    color: #ffffff;
  }
  
  .korkiai-chat-header-content p {
    font-size: 13px;
    opacity: 0.9;
    letter-spacing: 0.01em;
    font-weight: 400;
  }
  
  .korkiai-chat-header-actions {
    display: flex;
    gap: 10px;
  }
  
  .korkiai-chat-header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
  }
  
  .korkiai-chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
  
  .korkiai-chat-header-btn svg {
    width: 14px;
    height: 14px;
  }
  
  /* Body */
  .korkiai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: #ffffff;
    font-family: 'Plus Jakarta Sans', sans-serif;
    scrollbar-width: thin;
    scrollbar-color: rgba(29, 125, 87, 0.3) rgba(255, 255, 255, 0.8);
  }
  
  /* Formularz RODO */
  .korkiai-chat-form {
    background: #ffffff;
    padding: 48px 68px;
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(86, 63, 197, 0.12), 0 0 0 1px rgba(86, 63, 197, 0.08);
    border: none;
    display: flex;
    flex-direction: column;
    gap: 36px;
  }
  
  .korkiai-chat-form h4 {
    font-size: 1.4375rem;
    font-weight: 400;
    margin: 0 0 0.5rem 0;
    color: #563FC5;
    letter-spacing: -0.01em;
    font-family: "Instrument Serif", serif;
    line-height: 1.25;
  }
  
  .korkiai-chat-form p {
    font-size: 1rem;
    color: #5a564d;
    margin: 0 0 1rem 0;
    line-height: 1.6;
    font-weight: 400;
    font-family: "Plus Jakarta Sans", sans-serif;
  }
  
  .korkiai-form-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  
  .korkiai-form-group label {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #444444;
    letter-spacing: 0.01em;
    margin-bottom: 0.5rem;
    font-family: "Plus Jakarta Sans", sans-serif;
  }
  
  .korkiai-form-group input {
    width: 100%;
    padding: 15px 18px;
    border: 2px solid rgba(86, 63, 197, 0.15);
    border-radius: 10px;
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.334;
    transition: all 0.3s ease;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(86, 63, 197, 0.08);
    font-family: "Plus Jakarta Sans", sans-serif;
    color: #444444;
  }

  .korkiai-form-group input::placeholder {
    color: #6c757d;
    font-weight: 400;
  }
  
  .korkiai-form-group input:focus {
    outline: none;
    border-color: #563FC5;
    box-shadow: 0 0 0 4px rgba(86, 63, 197, 0.15), 0 4px 16px rgba(86, 63, 197, 0.12);
    transform: translateY(-1px);
  }
  
  .korkiai-form-group.error input {
    border-color: #dc3545;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.15);
  }
  
  .korkiai-form-error {
    color: #dc3545;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: none;
    font-weight: 400;
    font-family: "Plus Jakarta Sans", sans-serif;
  }
  
  .korkiai-form-group.error .korkiai-form-error {
    display: block;
  }
  
  /* Zgody */
  .korkiai-consent-group {
    margin-bottom: 24px;
    background: rgba(86, 63, 197, 0.03);
    border: 2px solid rgba(86, 63, 197, 0.08);
    border-radius: 12px;
    padding: 24px;
  }
  
  .korkiai-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    font-size: 0.9375rem;
    color: #444444;
    cursor: pointer;
    line-height: 1.334;
    font-weight: 400;
    font-family: "Plus Jakarta Sans", sans-serif;
  }
  
  .korkiai-consent-label input[type="checkbox"] {
    margin-top: 2px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: #563FC5;
    border-radius: 4px;
  }
  
  .korkiai-consent-label a {
    color: #563FC5;
    text-decoration: underline;
    text-decoration-color: rgba(86, 63, 197, 0.4);
    font-weight: 500;
  }
  
  .korkiai-consent-label a:hover {
    text-decoration-thickness: 2px;
    text-decoration-color: rgba(86, 63, 197, 0.8);
  }
  
  .korkiai-consent-required {
    color: #dc3545;
  }
  
  /* Przyciski */
  .korkiai-btn {
    width: 100%;
    padding: 18px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.25;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    letter-spacing: 0.01em;
    font-family: "Plus Jakarta Sans", sans-serif;
  }
  
  .korkiai-btn-primary {
    background: linear-gradient(135deg, #563FC5 0%, #745EE0 100%);
    color: #ffffff;
    box-shadow: 0 6px 24px rgba(86, 63, 197, 0.35);
    border: 2px solid transparent;
  }
  
  .korkiai-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #644FCA 0%, #563FC5 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(86, 63, 197, 0.45);
    border-color: rgba(255, 255, 255, 0.2);
  }
  
  .korkiai-btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }
  
  /* Wiadomości */
  .korkiai-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 8px;
  }
  
  .korkiai-message {
    display: flex;
    animation: messageSlideIn 0.3s ease;
  }
  
  @keyframes messageSlideIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .korkiai-message.user {
    justify-content: flex-end;
    margin-left: 20px;
  }
  
  .korkiai-message-content {
    max-width: 75%;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
  }
  
  .korkiai-message.user .korkiai-message-content {
    background: linear-gradient(135deg, #563FC5 0%, #745EE0 100%);
    color: #ffffff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 16px rgba(86, 63, 197, 0.25);
  }
  
  .korkiai-message.agent {
    margin-right: 20px;
  }
  
  .korkiai-message.agent .korkiai-message-content {
    background: #f8f9fa;
    color: #2c3e50;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(86, 63, 197, 0.1);
    border: 1px solid rgba(86, 63, 197, 0.1);
  }
  
  .korkiai-message-time {
    font-size: 12px;
    color: #888888;
    margin-top: 4px;
    text-align: right;
  }
  
  .korkiai-message.user .korkiai-message-time {
    color: rgba(255, 255, 255, 0.8);
  }
  
  /* Typing indicator */
  .korkiai-typing {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    width: fit-content;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(35, 178, 123, 0.15);
  }
  
  .korkiai-typing.active {
    display: flex;
  }
  
  .korkiai-typing-dot {
    width: 8px;
    height: 8px;
    background: #23b27b;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
    opacity: 0.75;
  }
  
  .korkiai-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
  }
  
  .korkiai-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
  }
  
  @keyframes typingBounce {
    0%, 60%, 100% {
      transform: translateY(0);
    }
    30% {
      transform: translateY(-8px);
    }
  }
  
  /* Footer - input */
  .korkiai-chat-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(86, 63, 197, 0.1);
    background: #ffffff;
    border-radius: 0 0 20px 20px;
    box-shadow: inset 0 1px 0 rgba(86, 63, 197, 0.05);
  }
  
  .korkiai-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
  }
  
  .korkiai-chat-input {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid rgba(86, 63, 197, 0.2);
    border-radius: 16px;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    transition: all 0.2s ease;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(86, 63, 197, 0.05);
  }
  
  .korkiai-chat-input:focus {
    outline: none;
    border-color: #563FC5;
    box-shadow: 0 0 0 3px rgba(86, 63, 197, 0.1);
  }
  
  .korkiai-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #563FC5 0%, #745EE0 100%);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(86, 63, 197, 0.3);
  }
  
  .korkiai-send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #644FCA 0%, #563FC5 100%);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 16px rgba(86, 63, 197, 0.4);
  }
  
  .korkiai-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }
  
  .korkiai-send-btn svg {
    width: 18px;
    height: 18px;
  }
  
  .korkiai-chat-body::-webkit-scrollbar {
    width: 4px;
  }

  .korkiai-chat-body::-webkit-scrollbar-track {
    background: rgba(86, 63, 197, 0.05);
  }

  .korkiai-chat-body::-webkit-scrollbar-thumb {
    background: rgba(86, 63, 197, 0.3);
    border-radius: 2px;
  }

  /* Responsywność */
  @media (max-width: 480px) {
    #korkiai-chat-container {
      width: calc(100vw - 24px);
      height: calc(100vh - 80px);
      left: 12px;
      top: 40px;
      bottom: auto;
      border-radius: 20px;
    }
    
    #korkiai-chat-launcher {
      left: 16px;
      bottom: 20px;
      width: 56px;
      height: 56px;
    }
    
    .korkiai-chat-body {
      padding: 28px;
    }
    
    .korkiai-chat-header {
      padding: 16px 20px;
    }
    
    .korkiai-chat-header-content h3 {
      font-size: 16px;
    }
    
    .korkiai-chat-header-content p {
      font-size: 12px;
    }
    
    .korkiai-chat-header-btn {
      width: 36px;
      height: 36px;
      min-width: 36px;
    }
    
    .korkiai-chat-form {
      padding: 36px 56px;
      gap: 32px;
    }
    
    .korkiai-chat-form h4 {
      font-size: 1.3rem;
    }
    
    .korkiai-chat-form p {
      font-size: 0.9rem;
    }
    
    .korkiai-form-group input {
      padding: 14px 16px;
      font-size: 1rem;
    }
    
    .korkiai-btn {
      padding: 16px 20px;
      font-size: 1rem;
    }
  }
  
  /* Bardzo małe ekrany */
  @media (max-width: 360px) {
    #korkiai-chat-container {
      width: calc(100vw - 16px);
      left: 8px;
      top: 20px;
      height: calc(100vh - 40px);
    }
    
    .korkiai-chat-header {
      padding: 12px 16px;
    }
    
    .korkiai-chat-header-content h3 {
      font-size: 15px;
    }
    
    .korkiai-chat-header-content p {
      font-size: 11px;
    }
    
    .korkiai-chat-header-btn {
      width: 32px;
      height: 32px;
      min-width: 32px;
    }
    
    .korkiai-chat-form {
      padding: 24px 32px;
    }
  }
  
  /* Loading spinner */
  .korkiai-loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }
  
  @keyframes spin {
    to { transform: rotate(360deg); }
  }
