/* Floating Button */
#ctc-floating-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    animation: ctc-pulse 3s infinite;
    opacity: 0;
    transform: scale(0.8);
}

#ctc-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

#ctc-floating-btn:active {
    transform: scale(0.95);
}

.ctc-icon {
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: brightness(0) invert(1);
}

/* Dynamic Pulse Animation */
@keyframes ctc-pulse {
    0% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 0 0 0 var(--pulse-color);
    }
    50% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 0 0 8px var(--pulse-color);
    }
    100% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 0 0 0 var(--pulse-color);
    }
}

/* Modal */
.ctc-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ctc-modal.ctc-show {
    opacity: 1;
    visibility: visible;
}

.ctc-modal-content {
    background: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    border-radius: 24px;
    width: 90%;
    max-width: 520px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.ctc-modal.ctc-show .ctc-modal-content {
    transform: translate(-50%, -50%);
}

.ctc-close {
    position: absolute;
    right: 20px;
    top: 20px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.ctc-close:hover {
    background: #f1f5f9;
    color: #334155;
}

/* Modal Body */
.ctc-modal-body {
    padding: 48px 40px 40px;
    text-align: center;
}

.ctc-modal-header {
    margin-bottom: 40px;
    text-align: center;
}

.ctc-modal-title {
    display: block;
    margin: 16px 0 16px;
    font-size: 2.2rem;
    color: #1e293b;
    font-weight: 700;
    line-height: 1.1;
}

.ctc-modal-body p {
    margin: 30px 0 0;
    color: #475569;
    line-height: 1.5;
    font-size: 13px;
    text-align: center;
}

/* Actions */
.ctc-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 40px 0 32px;
}

/* Buttons */
.ctc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    text-decoration: none;
    border-radius: 16px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.ctc-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.ctc-btn-large {
    padding: 20px 32px;
    font-size: 18px;
    font-weight: 700;
}

.ctc-btn-primary {
    background: var(--primary-color, #2563eb);
    color: white;
}

.ctc-btn-primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--primary-color, #2563eb) 85%, white);
    transform: translateY(-1px);
}

.ctc-btn-secondary {
    background: #334155;
    color: white;
    font-size: 14px;
    padding: 12px 20px;
}

.ctc-btn-secondary:hover:not(:disabled) {
    background: color-mix(in srgb, #334155 85%, white);
    transform: translateY(-1px);
}

.ctc-btn-small {
    font-size: 13px;
    padding: 10px 18px;
}

.ctc-btn svg {
    flex-shrink: 0;
}

/* Form */
.ctc-form {
    margin-top: 32px;
    animation: ctc-slideIn 0.3s ease-out;
}

@keyframes ctc-slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ctc-form-group {
    margin-bottom: 24px;
}

.ctc-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    background: white;
    transition: all 0.2s ease;
    overflow: hidden;
}

.ctc-input-wrapper:focus-within {
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.ctc-phone-icon {
    padding: 0 16px;
    color: #64748b;
    flex-shrink: 0;
}

.ctc-form-control {
    border: none;
    outline: none;
    padding: 16px 16px 16px 0;
    font-size: 16px;
    width: 100%;
    background: transparent;
    color: #1e293b;
    text-align: center;
}

.ctc-form-control::placeholder {
    color: #94a3b8;
}

.ctc-privacy-note {
    font-size: 12px;
    color: #64748b;
    margin-top: 28px;
    line-height: 1.4;
    text-align: center;
}

.ctc-privacy-note a {
    color: var(--primary-color, #2563eb);
    text-decoration: none;
    font-weight: 500;
}

.ctc-privacy-note a:hover {
    text-decoration: underline;
}

/* Success State */
.ctc-form-success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white !important;
    padding: 40px 32px;
    border-radius: 20px;
    margin-top: 32px;
    text-align: center;
    animation: ctc-successSlide 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ctc-successSlide {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ctc-success-icon {
    margin-bottom: 16px;
}

.ctc-success-icon svg {
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.ctc-form-success h4 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.ctc-form-success p {
    margin: 0;
    color: white;
    opacity: 0.95;
    font-size: 14px;
    font-weight: 400;
}

/* Anti-spam */
.ctc-honeypot {
    position: absolute;
    left: -5000px;
    top: -5000px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Loading state */
.ctc-btn.ctc-loading {
    position: relative;
    color: transparent;
}

.ctc-btn.ctc-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: ctc-spin 1s linear infinite;
}

@keyframes ctc-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast notifications */
.ctc-toast {
    position: fixed;
    bottom: 100px;
    right: 24px;
    background: #ef4444;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.ctc-toast.ctc-show {
    transform: translateX(0);
}

/* Focus styles for accessibility */
.ctc-btn:focus-visible,
.ctc-close:focus-visible {
    outline: 2px solid var(--primary-color, #2563eb);
    outline-offset: 2px;
}

.ctc-form-control:focus {
    outline: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    #ctc-floating-btn {
        width: 56px;
        height: 56px;
        bottom: 20px;
        right: 20px;
    }
    
    .ctc-icon {
        width: 20px;
        height: 20px;
    }
    
    .ctc-modal {
        background: white;
    }
    
    .ctc-modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: translateY(100%);
    }
    
    .ctc-modal.ctc-show .ctc-modal-content {
        transform: translateY(0);
    }
    
    .ctc-modal-body {
        padding: 40px 24px;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        box-sizing: border-box;
    }
    
    .ctc-modal-header {
        margin-bottom: 32px;
        text-align: center;
    }
    
    .ctc-modal-title {
        font-size: 2.0rem;
    }
    
    .ctc-modal-body p {
        font-size: 14px;
        margin-bottom: 32px;
        text-align: center;
    }
    
    .ctc-btn-large {
        padding: 16px 24px;
        font-size: 16px;
    }
    
    .ctc-btn {
        font-size: 14px;
        padding: 14px 20px;
    }
    
    .ctc-form-control {
        padding: 14px 12px 14px 0;
        font-size: 16px; /* Prevents zoom on iOS */
        text-align: center;
    }
    
    .ctc-close {
        top: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
    }
    
    .ctc-toast {
        right: 20px;
        left: 20px;
        max-width: none;
        bottom: 80px;
    }
}

@media (max-width: 480px) {
    .ctc-modal-body {
        padding: 32px 20px;
    }
    
    .ctc-modal-title {
        font-size: 1.8rem;
        margin-top: 15%;
    }
    
    .ctc-btn-large {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .ctc-icon {
        background-size: 24px 24px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    #ctc-floating-btn {
        animation: none;
    }
    
    .ctc-pulse {
        animation: none;
    }
}

/* Dark mode support - ONLY for desktop */
@media (prefers-color-scheme: dark) and (min-width: 769px) {
    .ctc-modal {
        background: rgba(0, 0, 0, 0.8);
    }
    
    .ctc-modal-content {
        background: #1e293b;
        color: white;
    }
    
    .ctc-modal-title {
        color: #f1f5f9;
    }
    
    .ctc-modal-body p {
        color: #cbd5e1;
    }
    
    .ctc-close {
        color: #94a3b8;
    }
    
    .ctc-close:hover {
        background: #334155;
        color: #e2e8f0;
    }
    
    .ctc-input-wrapper {
        background: #334155;
        border-color: #475569;
    }
    
    .ctc-form-control {
        color: #f1f5f9;
    }
    
    .ctc-form-control::placeholder {
        color: #64748b;
    }
    
    .ctc-phone-icon {
        color: #94a3b8;
    }
}

/* Mobile always uses light mode - no dark mode overrides */
@media (max-width: 768px) {
    .ctc-modal {
        background: white !important;
    }
    
    .ctc-modal-content {
        background: white !important;
        color: #1e293b !important;
    }
    
    .ctc-modal-title {
        color: #1e293b !important;
    }
    
    .ctc-modal-body p {
        color: #475569 !important;
    }
    
    .ctc-close {
        color: #64748b !important;
    }
    
    .ctc-close:hover {
        background: #f1f5f9 !important;
        color: #334155 !important;
    }
    
    .ctc-input-wrapper {
        background: white !important;
        border-color: #e2e8f0 !important;
    }
    
    .ctc-form-control {
        color: #1e293b !important;
    }
    
    .ctc-form-control::placeholder {
        color: #94a3b8 !important;
    }
    
    .ctc-phone-icon {
        color: #64748b !important;
    }
}

/* Enhanced security styling */
.ctc-security-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    display: none;
}

.ctc-form.ctc-security-error .ctc-security-warning {
    display: block;
}

/* Rate limit styling */
.ctc-rate-limit-notice {
    background: #fee2e2;
    border: 1px solid #ef4444;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    margin: 16px 0;
}

/* Enhanced button states */
.ctc-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ctc-btn:not(:disabled):active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Improved form validation styling */
.ctc-form-control:valid {
    border-color: #10b981;
}

/* Better loading animation */
.ctc-btn.ctc-loading {
    pointer-events: none;
    opacity: 0.8;
}

.ctc-btn.ctc-loading span {
    opacity: 0;
}

/* Enhanced accessibility */
@media (prefers-reduced-motion: reduce) {
    .ctc-toast {
        transition: none;
    }
    
    .ctc-modal {
        transition: none;
    }
    
    .ctc-modal-content {
        transition: none;
    }
    
    .ctc-form {
        animation: none;
    }
    
    .ctc-form-success {
        animation: none;
    }
}

/* Print styles */
@media print {
    #ctc-floating-btn,
    .ctc-modal,
    .ctc-toast {
        display: none !important;
    }
}

/* Poprawiona ikona dla mobile */
.ctc-icon {
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: brightness(0) invert(1);
    /* Dodanie antyaliasingu */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Mobile - zwiÄ™kszenie rozmiaru dla lepszej czytelnoÅ›ci */
@media (max-width: 768px) {
    #ctc-floating-btn {
        width: 56px;
        height: 56px;
        bottom: 20px;
        right: 20px;
    }
    
    .ctc-icon {
        width: 22px; /* ZwiÄ™kszenie z 20px */
        height: 22px;
        background-size: 22px 22px; /* DokÅ‚adny rozmiar */
        /* Lepsze renderowanie na mobile */
        image-rendering: auto;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* High DPI - poprawka dla retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .ctc-icon {
        background-size: 24px 24px;
    }
    
    /* Mobile retina */
    @media (max-width: 768px) {
        .ctc-icon {
            background-size: 22px 22px;
        }
    }
}

/* Dodatkowa optymalizacja dla bardzo maÅ‚ych ekranÃ³w */
@media (max-width: 480px) {
    .ctc-icon {
        width: 20px;
        height: 20px;
        background-size: 20px 20px;
    }
}

/* WhatsApp */

.ctc-btn-row {
    display: flex;
    gap: 12px;
}

.ctc-btn-row .ctc-btn {
    flex: 1;
    min-width: 0;
}

.ctc-whatsapp-btn {
    background: #25d366 !important;
    color: white !important;
}

.ctc-whatsapp-btn:hover:not(:disabled) {
    background: #128c7e !important;
    transform: translateY(-1px);
}

/* Mobile */
@media (max-width: 768px) {
    .ctc-btn-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .ctc-btn-row .ctc-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ctc-btn-row {
        gap: 12px;
    }
}

/* Ukrycie .ctc-actions gdy formularz jest widoczny */
.ctc-form[style*="block"] ~ .ctc-actions {
    display: none !important;
}

/* Alternatywnie - bardziej precyzyjna metoda */
.ctc-modal-body.ctc-form-active .ctc-actions {
    display: none !important;
}

/* Zmniejszenie marginesÃ³w w formularzu dla lepszego wyglÄ…du */
.ctc-form {
    margin-top: 20px; /* zmniejszone z 32px */
}

.ctc-modal-header {
    margin-bottom: 24px; /* zmniejszone z 40px */
}