@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;700&display=swap');

/* --- איפוס גלובלי --- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f2f2f7; direction: rtl;
    display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}

.d-none { display: none !important; }

/* --- Header --- */
header#main-header {
    background-color: transparent; padding: 15px 0 5px 0;
    display: flex; justify-content: center; align-items: center;
    gap: 8px; z-index: 10; flex-shrink: 0;
}

h1.main-title {
    font-family: 'Great Vibes', cursive;
    font-size: 1.8rem; color: #1c1c1e;
    margin: 0; line-height: 1.1; white-space: nowrap;
    text-shadow: 0px 1px 2px rgba(0,0,0,0.1);
}

/* --- Selectors (גיל ומין) --- */
.selectors-wrapper {
    width: 100%; max-width: 600px; margin: 0 auto 10px auto;
    padding: 0 15px; z-index: 5;
}

.selectors-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; width: 100%;
}

/* iOS Segment Style */
.ios-segment-new {
    background-color: #e3e3e8; border-radius: 10px; padding: 3px;
    display: flex; position: relative; height: 36px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
    flex: 1; min-width: 0;
}

.age-segment { overflow-x: auto; scrollbar-width: none; }
.age-segment::-webkit-scrollbar { display: none; }

.seg-btn {
    border: none; background: transparent; border-radius: 8px;
    font-size: 0.9rem; font-weight: 500; font-family: 'Heebo', sans-serif;
    color: #1c1c1e; cursor: pointer; padding: 0 12px; white-space: nowrap;
    height: 100%; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1); flex: 1;
}

.seg-btn.selected {
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.05);
    font-weight: 700; color: #000;
}

/* Gender Toggle Switch */
.gender-switch-container {
    position: relative; width: 110px; height: 36px;
    background-color: #e3e3e8; border-radius: 18px; padding: 3px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
    display: flex; cursor: pointer; flex: 0 0 auto;
}
.gender-checkbox { position: absolute; opacity: 0; width: 0; height: 0; }
.gender-slider {
    position: absolute; top: 3px; right: 3px;
    width: 50%; height: calc(100% - 6px);
    background-color: #ffffff; border-radius: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.05);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1); z-index: 1;
}
.gender-labels { position: relative; width: 100%; height: 100%; display: flex; z-index: 2; }
.gender-option {
    flex: 1; display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; font-weight: 500; font-family: 'Heebo', sans-serif;
    color: #8e8e93; transition: color 0.3s;
}
.gender-checkbox:not(:checked) ~ .gender-labels .option-male { color: #000; font-weight: 700; }
.gender-checkbox:checked ~ .gender-labels .option-female { color: #000; font-weight: 700; }
.gender-checkbox:checked ~ .gender-slider { transform: translateX(-100%); }

/* --- הגריד הראשי - נעול ומוגדר --- */
#app-container {
    flex: 1; width: 100%;
    /* הגבלת רוחב קריטית - זה מה שמונע כפתורים ענקיים */
    max-width: 330px; 
    margin: 0 auto;
    align-self: center; /* מרכוז */
    padding: 10px 0 20px 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 עמודות שוות */
    gap: 15px; /* מרווח בין כפתורים */
    align-content: start; overflow-y: auto;
}

.base-btn {
    width: 100%;
    height: 95px; /* גובה קבוע - מפתח ליציבות */
    border: none; border-radius: 18px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    color: #1c1c1e; cursor: pointer; padding: 0;
    background: #ffffff;
    box-shadow: 0 8px 16px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
    transition: transform 0.1s ease;
}
.base-btn:active { transform: scale(0.94); }

/* --- ה"כלוב" של האייקונים --- */
/* זה מה שפתר את הבעיה בעבר! */
.icon-box {
    width: 40px; height: 40px;
    display: flex; justify-content: center; align-items: center;
    margin-bottom: 5px;
    pointer-events: none; /* שלא יפריע ללחיצה */
}
/* האייקון עצמו ממלא את הכלוב */
.icon-box svg {
    width: 100%; height: 100%;
}

.btn-text { font-size: 0.9rem; font-weight: 700; font-family: 'Heebo', sans-serif; }

/* --- Footer משולב --- */
footer {
    padding: 20px; margin-top: auto; background: transparent;
    display: flex; justify-content: center; align-items: center; z-index: 100;
}
.footer-content {
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.85); padding: 5px 12px;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    backdrop-filter: blur(10px); height: 40px;
}
.footer-whatsapp { display: flex; align-items: center; text-decoration: none; padding-left: 8px; }
.whatsapp-icon-footer { width: 24px; height: 24px; fill: #25D366; }
.footer-sep { width: 1px; height: 14px; background-color: #c7c7cc; margin: 0 10px; }
.footer-text { font-size: 0.75rem; color: #444; font-weight: 500; font-family: 'Heebo', sans-serif; white-space: nowrap; }
.version-num { font-size: 0.75rem; color: #444; font-weight: 700; font-family: monospace; }

/* --- מסכים פנימיים --- */
.screen { position: fixed; inset: 0; background: #f2f2f7; z-index: 9999; display: flex; flex-direction: column; overflow-y: auto; }
.floating-header {
    background-color: #ff3b30; color: white;
    width: 90%; max-width: 500px; margin: 15px auto 10px auto;
    padding: 12px 20px; border-radius: 25px;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 6px 20px rgba(255, 59, 48, 0.3); flex-shrink: 0;
}
.floating-header h2 { margin: 0; font-size: 1.3rem; font-weight: 700; flex-grow: 1; text-align: center; }
.btn-header-action { background: rgba(255,255,255,0.2); border: none; color: white; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* טפסים */
.form-container { width: 90%; max-width: 500px; margin: 0 auto; }
.date-time-card { background: white; border-radius: 20px; padding: 15px; display: flex; gap: 15px; margin-bottom: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.03); }
.dt-item { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.dt-label { font-size: 0.8rem; color: #8e8e93; font-weight: 600; font-family: 'Heebo', sans-serif;}
.dt-input { border: none; background: #f2f2f7; padding: 10px; border-radius: 12px; font-size: 1rem; font-weight: 600; color: #1c1c1e; text-align: center; width: 100%; -webkit-appearance: none;}
.form-row { display: flex; gap: 15px; margin-bottom: 20px; }
.input-wrapper { flex: 1; display: flex; flex-direction: column; }
.input-label { font-weight: 700; color: #3a3a3c; margin-bottom: 8px; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; gap: 8px; font-family: 'Heebo', sans-serif; }
.input-field { width: 100%; padding: 16px; font-size: 1.5rem; border: none; border-radius: 20px; background: #ffffff; text-align: center; font-weight: 700; color: #1c1c1e; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.input-field:focus { outline: none; box-shadow: 0 0 0 2px #ff3b30; }
.btn-save { width: 100%; background: #007AFF; color: white; border: none; padding: 16px; border-radius: 20px; font-size: 1.2rem; font-weight: 700; cursor: pointer; box-shadow: 0 4px 15px rgba(0,122,255,0.3); margin-top: 10px; font-family: 'Heebo', sans-serif; }
.status-msg { text-align: center; margin: 15px 0; font-weight: 600; color: #ff3b30; min-height: 20px; }

/* היסטוריה */
.history-section { width: 90%; max-width: 500px; margin: 25px auto 40px auto; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; color: #8e8e93; font-weight: 600; font-size: 0.9rem; font-family: 'Heebo', sans-serif; }
.history-strip { background: white; border-radius: 18px; padding: 15px 18px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); display: flex; align-items: center; justify-content: space-between; }
.strip-bg-gold { border-left: 5px solid #34c759; }
.strip-bg-orange { border-left: 5px solid #ff9500; }
.strip-bg-red { border-left: 5px solid #ff3b30; }
.h-val { font-family: 'Heebo', sans-serif; font-weight: 700; color: #1c1c1e; font-size: 1.2rem; display: flex; align-items: center; gap: 4px;}
.h-time { font-size: 1rem; font-weight: 700; color: #1c1c1e; font-family: 'Heebo', sans-serif; }
.h-date { font-size: 0.8rem; color: #aeaeb2; font-family: 'Heebo', sans-serif; }

/* Modal */
.info-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 20000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.info-card { background: white; width: 85%; max-width: 320px; border-radius: 20px; padding: 25px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.info-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 15px; color: #ff3b30; }
.info-list { text-align: right; font-size: 0.9rem; line-height: 1.8; color: #333; margin-bottom: 20px; }
.info-list b { color: #007AFF; margin-left: 5px; }
.btn-close-modal { background: #007AFF; color: white; border: none; width: 100%; padding: 12px; border-radius: 12px; font-size: 1rem; font-weight: bold; }