:root { 
    --primary: #008f8c; 
    --primary-light: #e0f2f1;
    --primary-hover: #007573;
    --secondary: #2d3748; 
    --text-muted: #718096;
    --bg: #f4f7f8; 
    --white: #ffffff; 
    --border: #e2e8f0;
    --error: #e53e3e;
    --success: #38a169;
}

* { box-sizing: border-box; }

body { 
    font-family: 'Cairo', sans-serif; 
    background-color: var(--bg); 
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
    margin: 0; 
    direction: rtl; 
    color: var(--secondary);
}

header {
    text-align: center; 
    padding: 40px 0 20px;
}

.logo {
    font-size: 32px; 
    font-weight: 800; 
    color: var(--primary);
    letter-spacing: -1px;
}

.tagline {
    color: var(--text-muted);
    font-size: 1.1em;
    margin-top: 5px;
}

.main-wrapper { 
    max-width: 850px; 
    margin: 0 auto 60px auto; 
    background: var(--white); 
    border-radius: 20px; 
    padding: 40px; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.05); 
    border: 1px solid rgba(255,255,255,0.8);
}

/* ================= Steps Indicator ================= */
.steps-indicator { 
    display: flex; 
    justify-content: space-between; 
    margin-bottom: 40px; 
    position: relative; 
}

.progress-line { 
    position: absolute; 
    top: 50%; 
    transform: translateY(-50%);
    left: 0; 
    right: 0; 
    height: 4px; 
    background: var(--border); 
    z-index: 1; 
    border-radius: 2px;
}

.step-dot { 
    width: 35px; 
    height: 35px; 
    background: var(--white); 
    border: 3px solid var(--border);
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 2; 
    position: relative; 
    font-weight: 700; 
    color: var(--text-muted); 
    font-size: 0.9em;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
}

.step-dot.active { 
    background: var(--primary); 
    border-color: var(--primary);
    color: var(--white); 
    box-shadow: 0 0 0 4px var(--primary-light);
}

/* ================= Unit Selection Cards ================= */
.cards-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); 
    gap: 20px; 
}

.card { 
    border: 2px solid var(--border); 
    border-radius: 16px; 
    padding: 25px 15px; 
    text-align: center; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--white);
    position: relative;
    overflow: hidden;
}

.card input { position: absolute; opacity: 0; width: 0; height: 0; }

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: #cbd5e0;
}

.card:has(input:checked) { 
    border-color: var(--primary); 
    background: var(--primary-light); 
    box-shadow: 0 8px 25px rgba(0,143,140,0.15); 
}

.card .icon-box { 
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card .icon-box svg {
    width: 100%;
    height: 100%;
    fill: var(--text-muted);
    transition: fill 0.3s ease;
}

.card:has(input:checked) .icon-box svg {
    fill: var(--primary);
}

.card span.title { 
    font-weight: 700; 
    font-size: 1.05em; 
    color: var(--secondary); 
    transition: color 0.3s ease;
}

.card:has(input:checked) span.title {
    color: var(--primary-hover);
}

/* ================= Form Inputs & Selects ================= */
.stage { display: none; animation: slideUp 0.5s ease; }
.stage.active { display: block; }
@keyframes slideUp { from{opacity:0; transform:translateY(15px);} to{opacity:1; transform:translateY(0);} }

h2 { color: var(--secondary); border-bottom: 3px solid var(--primary-light); display: inline-block; padding-bottom: 8px; margin-top: 0; margin-bottom: 25px; font-weight: 800; }
h3 { margin-top: 30px; font-size: 1.2em; color: var(--secondary); }
h4 { color: var(--primary); margin-bottom: 15px; font-weight: 700; }

.input-group { margin-bottom: 20px; position: relative; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

label { 
    display: block; 
    margin-bottom: 8px; 
    font-weight: 700; 
    font-size: 0.95em; 
    color: var(--secondary);
}

input, select { 
    width: 100%; 
    padding: 14px 16px; 
    border: 2px solid var(--border); 
    border-radius: 10px; 
    font-family: 'Cairo', sans-serif; 
    font-size: 1em;
    background-color: #f8fafc;
    color: var(--secondary);
    transition: all 0.3s ease;
    appearance: none; 
}

select {
    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='%23718096' 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 16px center;
    background-size: 16px;
    padding-left: 40px;
}

input:focus, select:focus { 
    outline: none; 
    border-color: var(--primary); 
    background-color: var(--white);
    box-shadow: 0 0 0 4px rgba(0, 143, 140, 0.1);
}

.hidden { display: none !important; }

.error-msg { 
    color: var(--error); 
    font-size: 0.85em; 
    margin-top: 6px; 
    font-weight: 700; 
    display: none; 
}

.shutter-desc { 
    background: #edf2f7; 
    padding: 15px; 
    border-radius: 10px; 
    font-size: 0.9em; 
    color: #4a5568; 
    margin-bottom: 20px; 
    border-right: 4px solid var(--primary); 
    font-weight: 600;
}

.ceiling-indicator { 
    display: inline-block; 
    width: 12px; 
    height: 12px; 
    background-color: var(--success); 
    border-radius: 50%; 
    margin-right: 8px; 
    vertical-align: middle; 
    box-shadow: 0 0 8px rgba(56, 161, 105, 0.4);
}

/* ================= Dynamic Room Cards ================= */
.room-card { 
    background: var(--white); 
    border: 1px solid var(--border); 
    border-right: 5px solid var(--primary);
    padding: 25px; 
    border-radius: 12px; 
    margin-bottom: 20px; 
    position: relative; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    transition: transform 0.2s;
}

.room-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.04);
}

.main-room { border-right-color: #ecc94b; }

.room-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.room-header h4 { margin: 0; font-size: 1.2em; color: var(--secondary); }

.btn-del { 
    background: #fff5f5; 
    color: var(--error); 
    border: 1px solid #fed7d7; 
    padding: 8px 16px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-size: 0.85em; 
    font-weight: 700;
    transition: 0.2s;
}

.btn-del:hover { background: var(--error); color: var(--white); }

.btn-add { 
    width: 100%; 
    border: 2px dashed var(--primary); 
    background: var(--primary-light); 
    color: var(--primary-hover); 
    padding: 15px; 
    border-radius: 12px; 
    cursor: pointer; 
    font-weight: 800; 
    font-size: 1em;
    font-family: 'Cairo';
    transition: all 0.3s; 
    margin-bottom: 10px;
}

.btn-add:hover { 
    background: var(--primary); 
    color: var(--white); 
    border-style: solid;
}

/* ================= Results Section ================= */
.result-box { 
    text-align: center; 
    border-radius: 16px; 
    margin-bottom: 30px; 
}

.total-number { 
    font-size: 3em; 
    font-weight: 800; 
    margin: 10px 0 0; 
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.breakdown-list {
    background: var(--white);
    border-radius: 12px;
}

.result-item { 
    display: flex; 
    justify-content: space-between; 
    padding: 16px 0; 
    border-bottom: 1px dashed var(--border); 
    font-size: 1.1em;
    font-weight: 600;
}

.result-item:last-child { border-bottom: none; }
.result-item .val { color: var(--primary); font-weight: 800; }

/* ================= Action Buttons ================= */
.footer-actions { 
    display: flex; 
    justify-content: space-between; 
    margin-top: 40px; 
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-primary, .btn-sec { 
    padding: 14px 40px; 
    border-radius: 10px; 
    cursor: pointer; 
    border: none; 
    font-size: 1.1em; 
    font-weight: 800; 
    font-family: 'Cairo';
    transition: transform 0.2s, box-shadow 0.2s; 
}

.btn-primary { 
    background: var(--primary); 
    color: white; 
    box-shadow: 0 4px 15px rgba(0,143,140,0.3);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,143,140,0.4); }

.btn-sec { 
    background: #e2e8f0; 
    color: var(--secondary); 
}

.btn-sec:hover { background: #cbd5e0; }

@media (max-width: 600px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 10px; }
    .main-wrapper { padding: 20px; border-radius: 15px; margin-top: 20px; }
    .total-number { font-size: 2.2em; }
    .step-dot { width: 30px; height: 30px; font-size: 0.8em; }
}