.catalog-page{
padding:40px 0 20px;
}

.catalog-section{
padding:0 0 120px;
}

.catalog-card{
display:grid;
grid-template-columns:340px minmax(0,1fr);
gap:32px;
align-items:start;
}

/* SIDEBAR */

.catalog-sidebar{
background:#fff;
border-radius:32px;
padding:30px;
box-shadow:0 10px 30px rgba(0,0,0,.05);

position:sticky;
top:130px;
}

.section-label{
display:inline-flex;
padding:10px 18px;
border-radius:999px;
background:#EDF3EC;
color:#2E6A45;
font-weight:600;
margin-bottom:18px;
}

.sidebar-head h2{
font-size:64px;
line-height:1;
margin:0 0 10px;
}

.sidebar-head p{
margin:0;
color:#666;
line-height:1.6;
}

.stats-grid{
display:grid;
grid-template-columns:repeat(3,minmax(0,1fr));
gap:10px;
margin:32px 0;
}

.stat-box{
background:#F5F2ED;
border-radius:18px;
padding:18px;
display:flex;
flex-direction:column;
justify-content:center;
align-items:center;
min-height:92px;
text-align:center;
}

.stat-box span{
display:block;
font-size:12px;
color:#666;
margin-bottom:6px;
line-height:1.3;
}

.stat-box strong{
font-size:24px;
line-height:1;
}

.floors-wrapper{
margin-top:30px;
}

.floors-title{
font-size:18px;
font-weight:600;
margin-bottom:18px;
}

.floors-grid{
display:grid;
grid-template-columns:repeat(4,1fr);
gap:10px;
}

.floor{
appearance:none;
border:none;
background:#F5F2ED;
height:54px;
border-radius:14px;
font-weight:700;
cursor:pointer;
transition:.2s;
font-size:15px;
}

.floor.has-free{
background:#E6EFE8;
color:#2E6A45;
box-shadow:inset 0 0 0 1px rgba(46,106,69,.14);
}

.floor:hover{
transform:translateY(-2px);
}

.floor.active{
background:#2E6A45;
color:#fff;
}

/* SCHEME */

.catalog-scheme{
background:#fff;
border-radius:32px;
padding:24px;
box-shadow:0 10px 30px rgba(0,0,0,.05);
}

.scheme-top{
margin-bottom:22px;
}

.legend{
display:flex;
gap:24px;
flex-wrap:wrap;
}

.legend div{
display:flex;
align-items:center;
gap:10px;
font-weight:500;
}

.dot{
width:12px;
height:12px;
border-radius:50%;
display:block;
}

.green{background:#2E6A45;}
.yellow{background:#D6AF3F;}
.gray{background:#979797;}

.plan-canvas{
position:relative;
width:100%;
aspect-ratio:1536 / 1024;
min-height:620px;

background:#F5F2ED;
border-radius:24px;
overflow:hidden;
}

.floor-template{
position:absolute;
inset:0;

width:100%;
height:100%;

object-fit:contain;
object-position:center;
}

#overlaySvg{
position:absolute;
inset:0;

width:100%;
height:100%;
}

#overlaySvg polygon{
cursor:pointer;

stroke:#fff;
stroke-width:3;

transition:.2s;
}

polygon.free{
fill:rgba(46,106,69,.20);
}

polygon.booked{
fill:rgba(214,175,63,.34);
}

polygon.sold{
fill:rgba(140,140,140,.34);
}

polygon:hover{
opacity:.85;
}

/* MODAL */

.modal{
position:fixed;
inset:0;

background:rgba(0,0,0,.7);

display:flex;
align-items:center;
justify-content:center;

padding:24px;

z-index:9999;
}

.hidden{
display:none;
}

.modal-content{
background:#fff;

width:min(1200px,95vw);

border-radius:32px;

padding:28px;

position:relative;
}

.modal-close{
position:absolute;

top:20px;
right:20px;

width:46px;
height:46px;

border:none;

background:#F5F2ED;

border-radius:50%;

cursor:pointer;

font-size:26px;
}

.modal-grid{
display:grid;
grid-template-columns:460px 1fr;
gap:40px;
}

.modal-gallery{
display:flex;
flex-direction:column;
gap:14px;
position:relative;
}

.gallery-viewport{
overflow:hidden;
border-radius:24px;
background:#F5F2ED;
}

.gallery-track{
display:flex;
width:100%;
transition:transform .35s ease;
will-change:transform;
}

.gallery-slide{
flex:0 0 100%;
width:100%;
display:block;
}

.layout-preview{
width:100%;
border-radius:24px;
background:#F5F2ED;
padding:12px;
box-sizing:border-box;
}

.gallery-nav{
position:absolute;
top:50%;
transform:translateY(-50%);
width:40px;
height:40px;
border:none;
border-radius:50%;
background:#fff;
box-shadow:0 8px 18px rgba(0,0,0,.12);
cursor:pointer;
z-index:2;
font-size:26px;
line-height:1;
display:flex;
align-items:center;
justify-content:center;
}

.gallery-prev{left:-12px;}
.gallery-next{right:-12px;}

.gallery-dots{
display:flex;
justify-content:center;
gap:10px;
}

.dot-btn{
width:10px;
height:10px;
border:none;
border-radius:50%;
background:#D7D2CA;
padding:0;
}

.dot-btn.active{
background:#2E6A45;
}

.status-pill{
display:inline-flex;
width:auto;
align-self:flex-start;
padding:10px 16px;
border-radius:999px;
font-weight:600;
}

.modal-info{
display:flex;
flex-direction:column;
gap:16px;
}

.modal-info h2{
font-size:48px;
line-height:1.05;
margin:0;
}

.apartment-meta{
display:flex;
flex-direction:column;
gap:12px;
}

.meta-item{
display:flex;
align-items:center;
gap:12px;
padding:16px 18px;
background:#F5F2ED;
border-radius:18px;
}

.meta-item span{
color:#666;
}

.modal-description{
color:#666;
line-height:1.7;
margin-top:12px;
}

.modal-form{
display:flex;
flex-direction:column;
gap:14px;
}

.modal-form input{
height:58px;
border:none;
background:#F5F2ED;
padding:0 18px;
border-radius:14px;
}

.modal-submit{
height:58px;
}

.apartment-actions{
display:flex;
gap:12px;
margin-top:16px;
}

.action-btn{
flex:1;
min-width:0;
height:56px;
display:inline-flex;
align-items:center;
justify-content:center;
}

.action-btn-outline{
background:#fff;
border:1px solid rgba(46,106,69,.18);
color:#2E6A45;
box-shadow:none;
}

.action-btn-outline:hover{
background:#F5FAF7;
}

.action-btn-telegram{
background:#229ED9;
color:#fff;
box-shadow:0 10px 24px rgba(34,158,217,.18);
}

/* MOBILE */

@media(max-width:1100px){

.catalog-card{
grid-template-columns:1fr;
}

.catalog-sidebar{
position:relative;
top:auto;
}

.modal-grid{
grid-template-columns:1fr;
}

.modal-gallery{
gap:14px;
}

.gallery-nav{
display:none;
}

.plan-canvas{
min-height:500px;
}

}

@media(max-width:768px){

.stats-grid{
grid-template-columns:1fr;
}

.floors-grid{
grid-template-columns:repeat(3,1fr);
}

.modal-form{
grid-template-columns:1fr;
}

.apartment-actions{
flex-direction:column;
}

.plan-canvas{
min-height:420px;
}

.sidebar-head h2{
font-size:48px;
}

}

@media(max-width:980px){

.catalog-page{
padding:34px 0 18px;
}

.catalog-section{
padding-bottom:80px;
}

.catalog-card{
gap:22px;
}

.catalog-sidebar,
.catalog-scheme{
border-radius:26px;
padding:22px;
}

.stats-grid{
grid-template-columns:repeat(3,minmax(0,1fr));
gap:8px;
margin:24px 0;
}

.stat-box{
min-height:74px;
padding:12px 8px;
border-radius:16px;
}

.stat-box span{
font-size:11px;
}

.stat-box strong{
font-size:22px;
}

.floors-grid{
grid-template-columns:repeat(6,1fr);
}

.floor{
height:48px;
border-radius:13px;
}

.plan-canvas{
min-height:0;
height:auto;
border-radius:20px;
}

.modal{
align-items:flex-start;
padding:16px;
overflow:auto;
}

.modal-content{
width:100%;
max-height:none;
border-radius:26px;
padding:22px;
}

.modal-close{
top:14px;
right:14px;
width:42px;
height:42px;
font-size:24px;
z-index:5;
}

.modal-grid{
gap:24px;
}

.modal-info h2{
font-size:42px;
padding-right:46px;
}

.gallery-nav{
display:flex;
}

.gallery-prev{left:8px;}
.gallery-next{right:8px;}

.layout-preview{
border-radius:20px;
padding:10px;
}

.apartment-actions{
display:grid;
grid-template-columns:1fr 1fr;
}

}

@media(max-width:640px){

.catalog-page{
padding-top:28px;
}

.catalog-sidebar,
.catalog-scheme{
padding:18px;
border-radius:22px;
}

.sidebar-head h2{
font-size:42px;
}

.sidebar-head p{
font-size:15px;
}

.stats-grid{
grid-template-columns:repeat(3,minmax(0,1fr));
gap:7px;
}

.stat-box{
min-height:64px;
padding:10px 6px;
border-radius:14px;
}

.stat-box span{
font-size:10px;
line-height:1.2;
}

.stat-box strong{
font-size:18px;
}

.floors-grid{
grid-template-columns:repeat(4,1fr);
gap:8px;
}

.floor{
height:46px;
font-size:14px;
}

.legend{
gap:12px;
font-size:13px;
}

.plan-canvas{
width:calc(100vw - 60px);
max-width:100%;
aspect-ratio:1536 / 1024;
}

#overlaySvg polygon{
stroke-width:4;
}

.modal{
padding:10px;
}

.modal-content{
padding:18px;
border-radius:22px;
}

.modal-grid{
gap:20px;
}

.modal-info{
gap:14px;
}

.modal-info h2{
font-size:34px;
line-height:1;
}

.modal-description{
font-size:15px;
line-height:1.65;
margin-top:4px;
}

.meta-item{
padding:14px 16px;
border-radius:16px;
align-items:flex-start;
justify-content:space-between;
}

.meta-item strong{
text-align:right;
}

.modal-form input,
.modal-submit{
height:54px;
border-radius:14px;
}

.apartment-actions{
grid-template-columns:1fr;
gap:10px;
margin-top:10px;
}

.action-btn{
width:100%;
height:54px;
}

.gallery-nav{
width:36px;
height:36px;
font-size:22px;
}

.gallery-dots{
gap:8px;
}

}

@media(max-width:380px){

.stats-grid{
grid-template-columns:1fr;
}

.stat-box{
min-height:58px;
}

.floors-grid{
grid-template-columns:repeat(3,1fr);
}

}
