/* ========================================= */
/* Global Modal Styles                       */
/* ========================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* background-color: rgba(0, 27, 46, 0.7); Deep Navy tint */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000; /* Must be highest */
    
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.global-modal {
    width: 90%;
    max-height: 90vh;
    max-width: 450px;
    padding: 2.5rem 2rem;
    position: relative;
    direction: rtl;
    text-align: right;
    background-color: rgba(255, 255, 255, 1);
    
    /* Animation: Pops up slightly when opened */
    transform: translateY(20px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.modal-overlay.active .global-modal {
    transform: translateY(0) scale(1);
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    left: 15px; /* Left side because it's RTL */
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--clr-dark);
    opacity: 0.6;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.close-modal-btn:hover {
    color: var(--clr-accent);
    opacity: 1;
}

.scrollable-form {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-right: 10px; /* Space for scrollbar */
    margin-right: -10px;
    /* Custom thin scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--clr-accent) transparent;
}

.scrollable-form::-webkit-scrollbar { width: 6px; }
.scrollable-form::-webkit-scrollbar-track { background: transparent; }
.scrollable-form::-webkit-scrollbar-thumb { background-color: var(--clr-accent); border-radius: 10px; }

/* Sticky Header inside scrollable modal */
.sticky-header {
    padding-bottom: 1rem;
    z-index: 10;
}

/* Modal Content / View Switching */
.modal-content {
    display: none;
}
.modal-content.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.6rem;
    color: var(--clr-dark);
    margin-bottom: 0.5rem;
}

.modal-header p {
    font-size: 0.95rem;
    color: rgba(0, 27, 46, 0.7);
    line-height: 1.6;
}

.highlight-text {
    font-weight: bold;
    color: var(--clr-dark);
}

.full-width {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    margin-top: 1rem;
}


.phone-input-wrapper:focus-within {
    border-color: var(--clr-accent);
}

.country-select {
    background: transparent;
    border: none;
    border-right: 2px solid rgba(0, 27, 46, 0.15);
    padding: 0.8rem;
    font-size: 1rem;
    color: var(--clr-dark);
    outline: none;
    cursor: pointer;
}

.phone-input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 0.8rem 1rem;
    font-size: 1.1rem;
    color: var(--clr-dark);
    outline: none;
    letter-spacing: 1px;
}

/* OTP Input Styling */
.otp-input-group {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 1.5rem;
}

/* The Wrapper handles the borders and hides the overflow */
.otp-digit-wrapper {
    width: 50px;
    height: 60px;
    border: 2px solid rgba(0, 27, 46, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
    overflow: hidden; /* CRITICAL: Hides the number before it slides up */
    position: relative;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Highlight the wrapper when the invisible input inside is focused */
.otp-digit-wrapper:focus-within {
    border-color: var(--clr-accent);
    box-shadow: 0 0 0 4px rgba(248, 228, 98, 0.3);
}

/* The Input handles the typing and the slide animation */
.otp-digit {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--clr-dark);
    outline: none;
    
    /* Center the text perfectly */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Telegram Slide-Up Animation */
@keyframes OTPSlide {
    0% { 
        transform: translateY(100%); /* Starts completely below the box */
        opacity: 0; 
    }
    100% { 
        transform: translateY(0); /* Rests perfectly in the center */
        opacity: 1; 
    }
}

/* The class added by your existing JavaScript */
.otp-digit.pop {
    animation: OTPSlide 0.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* Footer Actions */
.modal-footer-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.text-btn {
    background: none;
    border: none;
    color: var(--clr-dark);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
}

.text-btn:hover {
    color: var(--clr-accent);
}

.text-btn.disabled {
    color: rgba(0, 27, 46, 0.4);
    cursor: not-allowed;
}

.text-muted {
    color: rgba(0, 27, 46, 0.3);
}
/* Kill Default Blue Outlines globally for this modal */
.phone-input:focus, .otp-digit:focus, button:focus {
    outline: none;
}

/* Update Wrapper for Focus State */
.phone-input-wrapper {
    display: flex;
    border: 2px solid rgba(0, 27, 46, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
    position: relative; /* Needed for dropdown positioning */
}

/* Changes to Yellow Accent when focused */
.phone-input-wrapper.focused {
    border-color: var(--clr-accent);
    box-shadow: 0 0 0 4px rgba(248, 228, 98, 0.2);
}

/* Custom Dropdown Styling */
.custom-dropdown {
    position: relative;
    border-right: 2px solid rgba(0, 27, 46, 0.1);
    user-select: none;
}

.dropdown-selected {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.8rem 1rem;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--clr-dark);
    transition: background 0.2s ease;
}

.dropdown-selected:hover {
    background: rgba(0, 27, 46, 0.05);
}

.dropdown-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.custom-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-options {
    position: absolute;
    top: 110%;
    left: 0;
    width: 120px;
    background: rgba(248, 244, 237, 0.95); /* Cream Glass */
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 27, 46, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 27, 46, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 100;
    overflow: hidden;
}

.custom-dropdown.open .dropdown-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.8rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 1.1rem;
}

.dropdown-option:hover {
    background: rgba(248, 228, 98, 0.3); /* Soft yellow hover */
}

.dropdown-option.active {
    background: var(--clr-accent);
    color: var(--clr-dark);
    font-weight: bold;
}
.custom-flag {
    width: 26px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0, 27, 46, 0.15); /* Adds physical depth */
    border: 1px solid rgba(0, 0, 0, 0.05); /* Stops white backgrounds from bleeding */
    flex-shrink: 0;
}

/* ========================================= */
/* OTP Bouncy Animation                      */
/* ========================================= */

@keyframes digitBounce {
    0% { 
        transform: translateY(15px) scale(0.5); 
        color: transparent; 
    }
    60% { 
        transform: translateY(-4px) scale(1.1); 
        color: var(--clr-dark); 
    }
    100% { 
        transform: translateY(0) scale(1); 
        color: var(--clr-dark); 
    }
}

/* This class is added via JavaScript when a number is typed */
.otp-digit.pop {
    animation: digitBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}


.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Custom Select Dropdown */
.custom-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23001b2E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 1rem center;
    background-size: 1em;
}

textarea.glass-input {
    resize: vertical;
    font-family: inherit;
}

/* Type Toggle (Lost vs Found) */
.type-toggle-group {
    display: flex;
    background: rgba(0, 27, 46, 0.05);
    border-radius: 12px;
    padding: 0.3rem;
    margin-bottom: 1.5rem;
}

.type-toggle-group input[type="radio"] {
    display: none;
}

.toggle-btn {
    flex: 1;
    text-align: center;
    padding: 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: rgba(0, 27, 46, 0.6);
    transition: all 0.3s ease;
}

.type-toggle-group input[type="radio"]:checked + .toggle-btn {
    background: var(--clr-dark);
    color: var(--clr-bg);
    box-shadow: 0 4px 10px rgba(0, 27, 46, 0.15);
}

/* Image Dropzone */
.image-upload-box {
    border: 2px dashed rgba(0, 27, 46, 0.2);
    border-radius: 12px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.image-upload-box:hover {
    border-color: var(--clr-accent);
    background: rgba(248, 228, 98, 0.1);
}

.image-upload-box svg {
    width: 32px;
    height: 32px;
    stroke: rgba(0, 27, 46, 0.5);
}

.image-upload-box span {
    font-weight: 600;
    color: var(--clr-dark);
}

.image-upload-box small {
    color: rgba(0, 27, 46, 0.5);
}

/* Prize Section Logic */
.prize-section-wrapper {
    background: rgba(248, 228, 98, 0.15); /* Light yellow tint */
    border: 1px solid rgba(248, 228, 98, 0.5);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
}

.custom-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--clr-dark);
    cursor: pointer;
}

.checkbox-group label {
    font-weight: 600;
    color: var(--clr-dark);
    cursor: pointer;
}

.prize-input-container {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    margin-top: 0;
}

.prize-input-container.open {
    max-height: 100px;
    opacity: 1;
    margin-top: 1rem;
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; gap: 0; }
}

/* ========================================= */
/* Multiple Image Preview Cards              */
/* ========================================= */

.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    
    /* ADDED: Smoothly animates the layout shift */
    transition: all 0.3s ease-in-out; 
}

/* ADDED: When the container has no images, hide it completely 
   so it doesn't leave an awkward empty margin */
.image-preview-container:empty {
    margin-top: 0;
    height: 0;
}

.preview-card {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(0, 27, 46, 0.1);
    box-shadow: 0 4px 10px rgba(0, 27, 46, 0.1);
    animation: fadeIn 0.3s ease;
}

.preview-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(218, 0, 0, 0.85); /* Red */
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.2s ease, transform 0.2s ease;
}

.preview-remove-btn:hover {
    background: rgb(218, 0, 0);
    transform: scale(1.1);
}

/* Input group styling – keep it consistent with the rest of the modal */
/* Override the two‑column grid for this particular form */
.form-row.single-col {
    display: flex;
    flex-direction: column;   /* stacks vertically */
    gap: 1.2rem;
}

/* The input wrapper */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-group label {
    font-weight: 600;
    color: var(--clr-dark);
    font-size: 0.9rem;
}

/* 🟡 VISIBLE input (not invisible glass) */
.glass-input {
    background: rgba(255, 255, 255, 0.85);         /* slightly solid */
    border: 2px solid rgba(0, 27, 46, 0.2);         /* navy‑tinted border */
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    color: var(--clr-dark);
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
}

.glass-input:focus {
    border-color: var(--clr-accent);
    box-shadow: 0 0 0 4px rgba(248, 228, 98, 0.25);
    background: rgba(255, 255, 255, 1);             /* fully opaque on focus */
}

.preview-card {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 27, 46, 0.1);
  box-shadow: 0 4px 10px rgba(0, 27, 46, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
}

/* Circular progress ring container */
.circular-progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}
.circular-progress circle {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.2s;
}
.circular-progress .bg-circle {
  stroke: rgba(0, 27, 46, 0.15);
}
.circular-progress .fg-circle {
  stroke: #2ecc71;               /* green accent */
  stroke-dasharray: 188.5;       /* circumference of r=30 → 2π*30 ≈ 188.5 */
  stroke-dashoffset: 188.5;      /* starts fully empty */
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.preview-remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  z-index: 3;
}

.uploaded {
  border: 2px solid var(--clr-accent);
}