.kol-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background-color: #ffffff;
    font-family: inherit;
    direction: rtl;
}

/* Modal Styles */
.kol-wrapper.kol-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: transparent;
    pointer-events: none; /* Allow clicks through when hidden, but wrapper is flex container */
    justify-content: center;
    align-items: center;
}

.kol-wrapper.kol-modal.kol-hidden {
    display: none;
}

.kol-wrapper.kol-modal:not(.kol-hidden) {
    pointer-events: auto;
}

.kol-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: -1;
    animation: kol-fade-in 0.2s ease-out;
}

.kol-wrapper.kol-modal .kol-container {
    position: relative;
    z-index: 10;
    animation: kol-scale-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: transparent; /* Container itself is transparent, box has background */
}

/* Close Button */
.kol-close-btn {
    position: absolute;
    top: 1rem;
    left: 1rem; /* RTL */
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: #f1f5f9;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: #64748b;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.kol-close-btn:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

@keyframes kol-scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.kol-container {
    width: 100%;
    max-width: 380px;
}

.kol-header {
    text-align: center;
    margin-bottom: 3rem;
}

/* In modal mode, maybe reduce top margin of header to fit better or keep it */
.kol-wrapper.kol-modal .kol-header {
    margin-bottom: 2rem;
}
.kol-wrapper.kol-modal .kol-box {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}


.kol-icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    background-color: #0f172a; /* slate-900 */
    border-radius: 0.75rem; /* rounded-xl */
    margin-bottom: 1.5rem;
}

.kol-title {
    font-size: 1.25rem; /* text-xl */
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.kol-box {
    background-color: white;
    border: 1px solid #f1f5f9; /* slate-100 */
    border-radius: 1.5rem; /* rounded-3xl */
    padding: 2rem;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.kol-loading-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(1px);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.5rem;
}

.kol-spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #0f172a;
    border-top-color: transparent;
    border-radius: 50%;
    animation: kol-spin 1s linear infinite;
}

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

.kol-form-group {
    margin-bottom: 1.5rem;
}

.kol-label {
    display: block;
    font-size: 0.75rem; /* text-xs */
    font-weight: 700;
    color: #94a3b8; /* slate-400 */
    margin-right: 0.25rem;
    margin-bottom: 0.5rem;
}

.kol-input {
    width: 100%;
    box-sizing: border-box;
    padding: 1rem 1.25rem;
    background-color: #f8fafc; /* slate-50 */
    border: 1px solid #f1f5f9; /* slate-100 */
    border-radius: 1rem; /* rounded-2xl */
    outline: none;
    transition: all 0.2s;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b; /* slate-800 */
    letter-spacing: 0.1em;
}

.kol-input:focus {
    background-color: white;
    border-color: #0f172a;
}

.kol-input::placeholder {
    color: #e2e8f0; /* slate-200 */
}

.kol-btn {
    width: 100%;
    padding: 1rem;
    background-color: #0f172a;
    color: white;
    border: none;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.kol-btn:hover {
    background-color: #000;
}

.kol-btn:active {
    transform: scale(0.98);
}

.kol-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.kol-otp-info {
    text-align: center;
    margin-bottom: 2rem;
}

.kol-phone-display {
    color: #1e293b;
    font-weight: 700;
    font-size: 0.875rem;
    direction: ltr;
}

.kol-otp-inputs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    direction: ltr; /* OTP inputs LTR */
}

.kol-otp-digit {
    width: 3rem;
    height: 3.5rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background-color: #f8fafc;
}
.kol-otp-digit:focus {
    border-color: #0f172a;
    background-color: #fff;
    outline: none;
}

.kol-actions {
    display: flex;
    justify-content: space-between;
    padding: 0 0.25rem;
    margin-top: 1rem;
}

.kol-text-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s;
}

.kol-text-btn:hover {
    color: #0f172a;
}

.kol-footer {
    margin-top: 3rem;
    text-align: center;
    opacity: 0.3;
}

.kol-footer p {
    font-size: 0.625rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Toast/Message */
.kol-message {
    position: fixed;
    top: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 10000; /* Higher than modal */
    animation: kol-fade-in 0.3s ease-out;
}

.kol-message.success {
    background-color: #f8fafc;
    border-color: #d1fae5;
    color: #059669;
}

.kol-message.error {
    background-color: #f8fafc;
    border-color: #ffe4e6;
    color: #e11d48;
}

@keyframes kol-fade-in {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.kol-hidden {
    display: none !important;
}
