/**
 * Modern Authentication Styles for PrestaShop 1.6
 * FIXED v4: Postcode field SAME HEIGHT as other inputs
 * Place in: themes/twoj-motyw/css/modules/authentication/authentication-modern.css
 */

/* ========================================
   CSS VARIABLES
   ======================================== */

:root {
    --auth-primary: #2563eb;
    --auth-primary-hover: #1d4ed8;
    --auth-secondary: #475569;
    --auth-secondary-hover: #334155;
    --auth-success: #10b981;
    --auth-warning: #f59e0b;
    --auth-danger: #ef4444;
    --auth-bg: #f8fafc;
    --auth-card-bg: #ffffff;
    --auth-border: #e2e8f0;
    --auth-text: #1e293b;
    --auth-text-muted: #64748b;
    --auth-input-bg: #ffffff;
    --auth-input-border: #cbd5e1;
    --auth-input-focus: #2563eb;
    --auth-radius: 12px;
    --auth-radius-sm: 8px;
    --auth-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --auth-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --auth-transition: all 0.2s ease;
    --auth-input-height: 48px;
}

/* ========================================
   WRAPPER
   ======================================== */

.auth-modern-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ========================================
   PAGE TITLE
   ======================================== */

.auth-page-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 28px;
    font-weight: 700;
    color: var(--auth-text);
    margin: 0 0 40px;
    text-align: center;
}

.auth-title-icon {
    width: 36px;
    height: 36px;
    stroke: var(--auth-primary);
}

/* ========================================
   CARDS CONTAINER
   ======================================== */

.auth-cards-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .auth-cards-container {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   CARD
   ======================================== */

.auth-card {
    background: var(--auth-card-bg);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    overflow: hidden;
    animation: authFadeInUp 0.5s ease forwards;
    opacity: 0;
}

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

.auth-card-full {
    max-width: 700px;
    margin: 0 auto;
}

.auth-card-header {
    padding: 30px;
    text-align: center;
    border-bottom: 1px solid var(--auth-border);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.auth-card-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.auth-card-icon svg {
    width: 32px;
    height: 32px;
}

.auth-card-icon-create {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.auth-card-icon-create svg {
    stroke: var(--auth-primary);
}

.auth-card-icon-login {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}

.auth-card-icon-login svg {
    stroke: var(--auth-secondary);
}

.auth-card-icon-guest {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.auth-card-icon-guest svg {
    stroke: var(--auth-success);
}

.auth-card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--auth-text);
    margin: 0 0 8px;
}

.auth-card-subtitle {
    font-size: 14px;
    color: var(--auth-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ========================================
   FORM
   ======================================== */

.auth-form {
    padding: 30px;
}

.auth-form-sections {
    padding: 30px;
}

.auth-form-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--auth-border);
}

.auth-form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.auth-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--auth-text);
    margin: 0 0 20px;
}

.auth-section-title svg {
    width: 20px;
    height: 20px;
    stroke: var(--auth-primary);
}

/* ========================================
   FORM GROUP
   ======================================== */

.auth-form-group {
    margin-bottom: 20px;
}

.auth-form-group:last-child {
    margin-bottom: 0;
}

.auth-form-row {
    display: flex;
    gap: 16px;
}

.auth-form-half {
    flex: 1;
    min-width: 0;
}

/* ========================================
   POSTCODE + CITY ROW - FIXED v4
   SAME HEIGHT for all inputs!
   ======================================== */

.auth-form-row-address {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.auth-form-group-postcode {
    flex: 0 0 140px;
    width: 140px;
}

.auth-form-group-city {
    flex: 1;
    min-width: 0;
}

/* Ensure postcode input has SAME height */
.auth-form-group-postcode .auth-input,
#postcode,
#postcode_invoice,
input[name="postcode"],
input[name="postcode_invoice"] {
    width: 100% !important;
    height: var(--auth-input-height) !important;
    min-height: var(--auth-input-height) !important;
    max-height: var(--auth-input-height) !important;
    padding: 0 16px !important;
    font-size: 15px !important;
    line-height: var(--auth-input-height) !important;
    box-sizing: border-box !important;
}

@media (max-width: 576px) {
    .auth-form-row,
    .auth-form-row-address {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }
    
    .auth-form-group-postcode {
        flex: 1;
        width: 100%;
    }
}

/* ========================================
   LABEL
   ======================================== */

.auth-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--auth-text);
    margin-bottom: 8px;
}

.auth-label svg {
    width: 16px;
    height: 16px;
    stroke: var(--auth-text-muted);
}

.auth-label .required {
    color: var(--auth-danger);
}

/* ========================================
   INPUT - All inputs SAME size (48px)
   ======================================== */

.auth-input,
.auth-modern-wrapper input[type="text"],
.auth-modern-wrapper input[type="email"],
.auth-modern-wrapper input[type="password"],
.auth-modern-wrapper input[type="tel"] {
    width: 100%;
    height: var(--auth-input-height) !important;
    min-height: var(--auth-input-height) !important;
    padding: 0 16px;
    font-size: 15px;
    line-height: var(--auth-input-height);
    color: var(--auth-text);
    background: var(--auth-input-bg);
    border: 2px solid var(--auth-input-border);
    border-radius: var(--auth-radius-sm);
    outline: none;
    transition: var(--auth-transition);
    box-sizing: border-box;
}

.auth-input::placeholder {
    color: #94a3b8;
}

.auth-input:focus,
.auth-modern-wrapper input:focus {
    border-color: var(--auth-input-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Warning state for address validation */
.auth-input-warning,
.auth-input.auth-input-warning {
    border-color: var(--auth-warning) !important;
    background: #fffbeb !important;
}

.auth-input-warning:focus {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2) !important;
}

.auth-input-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--auth-text-muted);
}

/* ========================================
   PASSWORD WRAPPER
   ======================================== */

.auth-password-wrapper {
    position: relative;
}

.auth-password-wrapper .auth-input {
    padding-right: 50px;
}

.auth-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--auth-text-muted);
}

.auth-password-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.auth-password-toggle:hover {
    color: var(--auth-text);
}

/* ========================================
   SELECT - Same height as inputs (48px)
   ======================================== */

.auth-select,
.auth-modern-wrapper select {
    width: 100%;
    height: var(--auth-input-height) !important;
    min-height: var(--auth-input-height) !important;
    padding: 0 40px 0 16px;
    font-size: 15px;
    line-height: var(--auth-input-height);
    color: var(--auth-text);
    background: var(--auth-input-bg);
    border: 2px solid var(--auth-input-border);
    border-radius: var(--auth-radius-sm);
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: var(--auth-transition);
    box-sizing: border-box;
}

.auth-select:focus {
    border-color: var(--auth-input-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========================================
   DATE ROW
   ======================================== */

.auth-date-row {
    display: flex;
    gap: 12px;
}

.auth-date-row .auth-select {
    flex: 1;
}

/* ========================================
   TEXTAREA
   ======================================== */

.auth-textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    color: var(--auth-text);
    background: var(--auth-input-bg);
    border: 2px solid var(--auth-input-border);
    border-radius: var(--auth-radius-sm);
    outline: none;
    resize: vertical;
    min-height: 100px;
    transition: var(--auth-transition);
    box-sizing: border-box;
    font-family: inherit;
}

.auth-textarea:focus {
    border-color: var(--auth-input-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========================================
   RADIO BUTTONS - NATIVE/CLASSIC STYLE
   No custom styling, just native browser radio
   ======================================== */

.auth-radio-group {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 8px 0;
}

.auth-radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Native radio input - visible and clickable */
.auth-radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--auth-primary);
}

.auth-radio-item label {
    font-size: 15px;
    color: var(--auth-text);
    cursor: pointer;
    user-select: none;
}

/* ========================================
   CHECKBOX - NATIVE/CLASSIC STYLE
   No custom styling, just native browser checkbox
   ======================================== */

.auth-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}

.auth-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

/* Native checkbox input - visible and clickable */
.auth-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 2px 0 0 0;
    cursor: pointer;
    accent-color: var(--auth-primary);
    flex-shrink: 0;
}

.auth-checkbox-item label {
    font-size: 14px;
    color: var(--auth-text);
    cursor: pointer;
    user-select: none;
    line-height: 1.5;
}

/* ========================================
   ADDRESS WARNING - INLINE
   ======================================== */

.auth-address-warning {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 12px 16px;
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: var(--auth-radius-sm);
    font-size: 13px;
    color: #92400e;
    font-weight: 500;
}

.auth-address-warning svg {
    width: 20px;
    height: 20px;
    stroke: #f59e0b;
    flex-shrink: 0;
}

/* ========================================
   BUTTONS
   ======================================== */

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--auth-radius-sm);
    cursor: pointer;
    transition: var(--auth-transition);
    text-decoration: none;
}

.auth-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.auth-btn-primary {
    background: var(--auth-primary);
    color: white;
}

.auth-btn-primary:hover {
    background: var(--auth-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.auth-btn-secondary {
    background: var(--auth-secondary);
    color: white;
}

.auth-btn-secondary:hover {
    background: var(--auth-secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(71, 85, 105, 0.3);
}

.auth-btn-large {
    width: 100%;
    padding: 18px 32px;
    font-size: 16px;
}

.auth-form-actions {
    margin-top: 24px;
}

.auth-form-actions .auth-btn {
    width: 100%;
}

/* ========================================
   FORGOT PASSWORD
   ======================================== */

.auth-forgot-password {
    margin-top: 16px;
    text-align: right;
}

.auth-forgot-password a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--auth-text-muted);
    text-decoration: none;
    transition: var(--auth-transition);
}

.auth-forgot-password a svg {
    width: 14px;
    height: 14px;
}

.auth-forgot-password a:hover {
    color: var(--auth-primary);
}

/* ========================================
   SECTION DIVIDER
   ======================================== */

.auth-section-divider {
    display: flex;
    align-items: center;
    margin: 40px 0;
}

.auth-section-divider::before,
.auth-section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-section-divider span {
    padding: 0 20px;
    font-size: 14px;
    color: var(--auth-text-muted);
    font-weight: 500;
}

/* ========================================
   GUEST SECTION
   ======================================== */

.auth-guest-section {
    margin-top: 40px;
}

.auth-card-guest {
    max-width: 800px;
    margin: 0 auto;
}

.auth-invoice-section {
    background: #f8fafc;
    margin: 0 -30px;
    padding: 30px !important;
    border-radius: 0;
}

/* ========================================
   FORM FOOTER
   ======================================== */

.auth-form-footer {
    padding: 30px;
    background: #f8fafc;
    border-top: 1px solid var(--auth-border);
}

.auth-required-info {
    font-size: 13px;
    color: var(--auth-text-muted);
    margin: 0 0 20px;
}

.auth-required-info .required {
    color: var(--auth-danger);
}

.auth-info-text {
    font-size: 13px;
    color: var(--auth-text-muted);
    margin: 0 0 16px;
    padding: 12px 16px;
    background: #eff6ff;
    border-radius: var(--auth-radius-sm);
}

/* ========================================
   ALERT
   ======================================== */

.auth-alert {
    padding: 14px 18px;
    border-radius: var(--auth-radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
}

.auth-alert.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ========================================
   POPUP
   ======================================== */

.auth-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
}

.auth-popup {
    background: white;
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow-lg);
    max-width: 420px;
    width: 100%;
    padding: 40px 30px;
    text-align: center;
}

.auth-popup-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.auth-popup-icon svg {
    width: 40px;
    height: 40px;
    stroke: #f59e0b;
}

.auth-popup-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--auth-text);
    margin: 0 0 16px;
}

.auth-popup-message {
    font-size: 15px;
    color: var(--auth-text-muted);
    line-height: 1.7;
    margin: 0 0 28px;
}

.auth-popup-message strong {
    color: var(--auth-text);
}

.auth-popup-message em {
    color: var(--auth-primary);
    font-style: normal;
    font-weight: 600;
}

.auth-popup-actions {
    display: flex;
    justify-content: center;
}

.auth-popup-actions .auth-btn {
    min-width: 160px;
}

/* ========================================
   UTILITIES
   ======================================== */

.unvisible {
    display: none !important;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .auth-modern-wrapper {
        padding: 20px 15px;
    }
    
    .auth-page-title {
        font-size: 22px;
        margin-bottom: 30px;
    }
    
    .auth-card-header {
        padding: 24px 20px;
    }
    
    .auth-card-icon {
        width: 56px;
        height: 56px;
    }
    
    .auth-card-icon svg {
        width: 28px;
        height: 28px;
    }
    
    .auth-card-title {
        font-size: 18px;
    }
    
    .auth-form {
        padding: 24px 20px;
    }
    
    .auth-form-sections {
        padding: 24px 20px;
    }
    
    .auth-form-footer {
        padding: 24px 20px;
    }
    
    .auth-invoice-section {
        margin: 0 -20px;
        padding: 24px 20px !important;
    }
    
    .auth-date-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .auth-radio-group {
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    :root {
        --auth-input-height: 44px;
    }
    
    .auth-input,
    .auth-select,
    .auth-modern-wrapper input,
    .auth-modern-wrapper select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    .auth-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .auth-btn-large {
        padding: 16px 24px;
    }
    
    .auth-popup {
        padding: 30px 20px;
    }
    
    .auth-popup-title {
        font-size: 20px;
    }
}