/**
 * JK Parts Widget - CSS
 * Style plaque d'immatriculation francaise
 */

/* ============================================
   CONTAINER & POSITIONNEMENT
   ============================================ */
.jkwidget-container {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.jkwidget-bottom-right {
    bottom: 92px;
    right: 20px;
}

.jkwidget-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* ============================================
   BOUTON PLAQUE FR
   ============================================ */
.jkwidget-button {
    position: relative;
    background: none;
    border: none;
    padding: 0;
    cursor: grab;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.25));
    transition: transform 0.3s ease, filter 0.3s ease;
    animation: jkwidget-bounce 2s ease-in-out infinite;
}

.jkwidget-button:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 20px rgba(0,0,0,0.35));
    animation: none;
}

@keyframes jkwidget-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Plaque style FR */
.jkwidget-plate {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 3px solid #000;
    border-radius: 5px;
    overflow: hidden;
    height: 44px;
}

.jkwidget-plate-blue {
    width: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.jkwidget-plate-stars {
    font-size: 6px;
    color: #FFD700;
    letter-spacing: -1px;
    line-height: 1;
}

.jkwidget-plate-country {
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    font-family: 'Arial Black', sans-serif;
    line-height: 1;
}

.jkwidget-plate-white {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    min-width: 80px;
}

.jkwidget-plate-text {
    font-family: 'Arial Black', 'Helvetica', sans-serif;
    font-size: 18px;
    font-weight: 900;
    color: #000;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* Pulse animation */
.jkwidget-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 5px;
    background: rgba(0, 51, 153, 0.3);
    animation: jkwidget-pulse-anim 2s ease-out infinite;
    pointer-events: none;
}

@keyframes jkwidget-pulse-anim {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* ============================================
   POPUP FORMULAIRE
   ============================================ */
.jkwidget-popup {
    position: absolute;
    /* top/bottom/left/right sont calculés dynamiquement par widget.js */
    width: 380px;
    max-height: 85vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.jkwidget-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.jkwidget-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
}

.jkwidget-popup-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.jkwidget-close {
    background: rgba(255,255,255,0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s;
}

.jkwidget-close:hover {
    background: rgba(255,255,255,0.2);
}

/* Formulaire */
.jkwidget-form {
    padding: 20px;
    max-height: calc(85vh - 140px);
    overflow-y: auto;
}

.jkwidget-field {
    margin-bottom: 16px;
}

.jkwidget-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.jkwidget-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.jkwidget-input:focus {
    outline: none;
    border-color: #003399;
    box-shadow: 0 0 0 3px rgba(0,51,153,0.1);
}

/* Input plaque stylisee */
.jkwidget-plate-input-wrap {
    margin-bottom: 10px;
}

.jkwidget-plate-input {
    display: flex;
    align-items: stretch;
    border: 3px solid #000;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    height: 48px;
}

.jkwidget-plate-input-blue {
    width: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.jkwidget-eu-stars {
    font-size: 7px;
    color: #FFD700;
    line-height: 1;
}

.jkwidget-eu-letter {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Arial Black', sans-serif;
}

.jkwidget-plate-input input {
    flex: 1;
    border: none;
    padding: 0 12px;
    font-family: 'Arial Black', 'Helvetica', sans-serif;
    font-size: 20px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    background: transparent;
}

.jkwidget-plate-input input:focus {
    outline: none;
}

.jkwidget-plate-input input::placeholder {
    color: #ccc;
    font-weight: 400;
    letter-spacing: 1px;
}

/* OU separator */
.jkwidget-or {
    display: flex;
    align-items: center;
    margin: 12px 0;
}

.jkwidget-or::before,
.jkwidget-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

.jkwidget-or span {
    padding: 0 12px;
    color: #999;
    font-size: 12px;
    text-transform: uppercase;
}

/* Lignes de pieces */
.jkwidget-part-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.jkwidget-part-name {
    flex: 2;
}

.jkwidget-part-ref {
    flex: 1;
}

.jkwidget-add-part {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 10px 14px;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    justify-content: center;
    transition: all 0.2s;
}

.jkwidget-add-part:hover {
    border-color: #003399;
    color: #003399;
    background: rgba(0,51,153,0.05);
}

/* Upload fichiers */
.jkwidget-file-upload {
    position: relative;
}

.jkwidget-file-upload input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    top: 0;
    left: 0;
    z-index: 2;
}

.jkwidget-file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    color: #999;
    text-align: center;
    transition: all 0.2s;
}

.jkwidget-file-upload:hover .jkwidget-file-label {
    border-color: #003399;
    color: #003399;
    background: rgba(0,51,153,0.05);
}

.jkwidget-file-label span {
    margin-top: 8px;
    font-size: 13px;
}

.jkwidget-file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.jkwidget-file-preview img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
}

/* Lignes */
.jkwidget-row {
    display: flex;
    gap: 12px;
}

.jkwidget-half {
    flex: 1;
}

/* Checkbox CGV */
.jkwidget-cgv {
    margin-top: 16px;
}

.jkwidget-container .jkwidget-checkbox {
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: #333 !important;
    line-height: 1.4 !important;
}

.jkwidget-container .jkwidget-checkbox input[type="checkbox"] {
    display: none !important;
}

.jkwidget-container .jkwidget-checkmark {
    display: inline-block !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    border: 2px solid #888 !important;
    border-radius: 5px !important;
    flex-shrink: 0 !important;
    position: relative !important;
    transition: all 0.2s !important;
    background: #fff !important;
    visibility: visible !important;
    opacity: 1 !important;
    box-sizing: border-box !important;
    margin-top: 1px !important;
}

.jkwidget-container .jkwidget-checkbox input[type="checkbox"]:checked + .jkwidget-checkmark {
    background: #003399 !important;
    border-color: #003399 !important;
}

.jkwidget-container .jkwidget-checkbox input[type="checkbox"]:checked + .jkwidget-checkmark::after {
    content: '' !important;
    position: absolute !important;
    left: 7px !important;
    top: 3px !important;
    width: 6px !important;
    height: 11px !important;
    border: solid #fff !important;
    border-width: 0 2px 2px 0 !important;
    transform: rotate(45deg) !important;
}

.jkwidget-container .jkwidget-cgv a,
.jkwidget-container .jkwidget-cgv a:link,
.jkwidget-container .jkwidget-cgv a:visited,
.jkwidget-container .jkwidget-cgv a:hover,
.jkwidget-container .jkwidget-cgv a:active {
    color: #003399 !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
    background: transparent !important;
}

/* Bouton submit */
.jkwidget-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.jkwidget-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26,26,46,0.4);
}

.jkwidget-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.jkwidget-submit-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: jkwidget-spin 0.8s linear infinite;
}

.jkwidget-submit.loading .jkwidget-submit-text {
    display: none;
}

.jkwidget-submit.loading .jkwidget-submit-loader {
    display: block;
}

@keyframes jkwidget-spin {
    to { transform: rotate(360deg); }
}

/* Footer */
.jkwidget-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid #eee;
    color: #27ae60;
    font-size: 13px;
    font-weight: 500;
}

/* ============================================
   ECRAN SUCCES
   ============================================ */
.jkwidget-success {
    display: none;
    padding: 40px 20px;
    text-align: center;
}

.jkwidget-success.active {
    display: block;
}

.jkwidget-success-icon {
    color: #27ae60;
    margin-bottom: 20px;
}

.jkwidget-success-icon svg {
    animation: jkwidget-check 0.5s ease-out;
}

@keyframes jkwidget-check {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.jkwidget-success h3 {
    font-size: 22px;
    color: #333;
    margin: 0 0 10px;
}

.jkwidget-success p {
    color: #666;
    font-size: 14px;
    margin: 0 0 20px;
}

.jkwidget-btn-new {
    background: #f0f0f0;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background 0.2s;
}

.jkwidget-btn-new:hover {
    background: #e0e0e0;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 440px) {
    .jkwidget-popup {
        width: calc(100vw - 40px);
        max-height: 80vh;
    }
    
    .jkwidget-row {
        flex-direction: column;
        gap: 0;
    }
    
    .jkwidget-half {
        width: 100%;
    }
}
