/* =========================================
   КАЛЬКУЛЯТОР UPK - CSS
========================================= */

:root {
    --upk-blue: #0377c0; 
    --upk-dark: #1d1d1f;
    --upk-gray: #f5f5f7;
    --upk-green: #34c759;
}

body { 
    font-family: 'Inter', sans-serif; 
    background-color: transparent; 
    color: var(--upk-dark); 
    margin: 0; 
    padding: 0; 
    line-height: 1.5; 
}

.apple-container { 
    max-width: 1100px; 
    margin: 0 auto; 
    padding: 20px; 
    box-sizing: border-box; 
}

/* --- УТИЛІТИ ТА АНІМАЦІЇ (Заміна inline styles) --- */
.hide { display: none !important; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.fw-bold { font-weight: bold; }
.text-blue { font-size: 18px; color: var(--upk-blue); }
.btn-full-width { width: 100%; }
.flex-1 { flex: 1; }

@keyframes fade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade {
    animation: fade 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    opacity: 0;
}
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }

/* --- ШАПКА --- */
.apple-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: #fff; 
    padding: 20px 30px; 
    border-radius: 16px; 
    margin-bottom: 20px; 
    box-shadow: 0 2px 15px rgba(0,0,0,0.03); 
}
.brand-info { display: flex; align-items: center; gap: 15px; }
.apple-logo { 
    width: 50px; height: 50px; 
    background: var(--upk-dark); color: #fff; 
    border-radius: 12px; display: flex; justify-content: center; align-items: center; 
    font-weight: 800; overflow: hidden; 
}
.apple-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-titles h1 { margin: 0; font-size: 22px; color: var(--upk-blue); }
.brand-titles p { margin: 0; font-size: 12px; color: #86868b; }
.header-details { font-size: 13px; color: #555; text-align: right; }

/* --- СІТКА --- */
.split-view { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 25px; 
    align-items: start; 
}

/* --- ВІДЖЕТИ --- */
.apple-widget { 
    background: #fff; 
    border-radius: 16px; 
    padding: 25px; 
    margin-bottom: 20px; 
    box-shadow: 0 2px 15px rgba(0,0,0,0.03); 
}
.summary-widget {
    background: #fff; 
    padding: 20px; 
    border-radius: 12px; 
    border: 1px solid #d2d2d7;
}
.badge { 
    display: inline-block; background: #eef6ff; color: var(--upk-blue); 
    padding: 5px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; margin-bottom: 15px; 
}

.flex-row { display: flex; gap: 15px; }
.flex-item { flex: 1; min-width: 0; }
.flex-full { width: 100%; }

label { display: block; font-size: 11px; font-weight: 600; color: #86868b; margin-bottom: 5px; text-transform: uppercase; }

.pro-input, select { 
    width: 100%; padding: 12px; 
    border: 1px solid #d2d2d7; border-radius: 8px; 
    font-family: 'Inter', sans-serif; font-size: 14px; 
    box-sizing: border-box; background: #fff; outline: none; transition: 0.2s; 
}
.pro-input:focus, select:focus { border-color: var(--upk-blue); box-shadow: 0 0 0 3px rgba(3,119,192,0.1); }
.inp-client-name { margin-bottom: 10px; font-weight: 600; }

.offer-main-title {
    color: var(--upk-blue);
    border-bottom: 2px solid var(--upk-blue);
    padding-bottom: 10px;
    margin-top: 0;
}

/* --- CANVAS --- */
.preview-box { 
    border: 1px solid #d2d2d7; border-radius: 12px; padding: 20px; 
    display: flex; justify-content: center; background: #fafafa; 
}
.preview-box canvas { max-width: 100%; height: auto; }

/* --- КНОПКИ --- */
.btn-apple-main { 
    background: #013a5e; 
    color: #ffffff; 
    border: none; 
    padding: 14px; border-radius: 8px; font-weight: 600; font-size: 14px; 
    cursor: pointer; transition: 0.2s; text-align: center; 
    display: flex; justify-content: center; align-items: center; gap: 8px;
}
.btn-apple-main:hover { background: #01243d; transform: translateY(-1px); } 
.btn-ghost { 
    background: #fff; color: var(--upk-dark); border: 1px solid #d2d2d7; 
    padding: 14px; border-radius: 8px; font-weight: 600; font-size: 14px; 
    cursor: pointer; transition: 0.2s; display: flex; justify-content: center; align-items: center; gap: 8px;
}
.btn-ghost:hover { background: #f9f9f9; }

.action-flex-row { display: flex; gap: 10px; margin-bottom: 15px; }

/* --- МЕСЕНДЖЕРИ --- */
.messenger-block { 
    background: #fff; 
    padding: 20px; 
    border-radius: 12px; 
    border: 1px solid #d2d2d7; 
}
#msg-send-text {
    font-size: 13px;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--upk-dark);
}
.messenger-buttons { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 10px; 
}
.messenger-buttons .btn-apple-main { 
    padding: 12px; 
    font-size: 12px; 
    white-space: nowrap; 
    box-sizing: border-box;
}
.messenger-buttons .btn-apple-main i { font-size: 16px; }

.bg-tg { background: #0088cc !important; }
.bg-vb { background: #7360f2 !important; }
.bg-em { background: #333 !important; }
.bg-ph { background: #34c759 !important; }

/* --- ЧЕКБОКСИ ТА ПОСЛУГИ --- */
.apple-switch { display: flex; align-items: center; cursor: pointer; gap: 10px; margin-bottom: 10px; width: 100%; }
.apple-switch input { display: none; }
.switch-track { width: 40px; height: 22px; background: #e5e5ea; border-radius: 22px; position: relative; transition: 0.3s; flex-shrink: 0; }
.switch-track::after { content: ''; position: absolute; width: 18px; height: 18px; background: #fff; border-radius: 50%; top: 2px; left: 2px; transition: 0.3s; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.apple-switch input:checked + .switch-track { background: var(--upk-green); }
.apple-switch input:checked + .switch-track::after { transform: translateX(18px); }
.apple-switch span { font-size: 13px; line-height: 1.3; }

.services-block { padding: 15px 20px; }
.services-block-title { margin: 0 0 15px 0; font-size: 14px; color: var(--upk-dark); }
.dynamic-frames { width: 100%; display: flex; flex-direction: column; gap: 15px; }

/* --- КОШИК --- */
.item-card { 
    background: #fff; border-radius: 12px; padding: 15px; margin-bottom: 10px; 
    border: 1px solid #eee; display: flex; align-items: center; gap: 15px; 
    position: relative; 
}
.item-info { flex: 1; min-width: 0; }
.item-info h4 { margin: 0 0 5px 0; font-size: 14px; white-space: normal; word-wrap: break-word; }
.item-stats { font-size: 12px; color: #86868b; line-height: 1.4; }
.item-price { font-weight: bold; font-size: 15px; white-space: nowrap; }

.btn-remove { 
    color: #ff3b30; cursor: pointer; opacity: 0.6; transition: 0.2s; 
    display: flex; justify-content: center; align-items: center; font-size: 18px;
}
.btn-remove:hover { opacity: 1; }

.summary-line { display: flex; justify-content: space-between; font-size: 14px; color: #555; margin-bottom: 8px; }
.discount-line { color: var(--upk-green); font-weight: bold; }
.summary-divider { border: 0; border-top: 1px solid #eee; margin: 10px 0; }
.total-grand { font-size: 18px; font-weight: 700; color: var(--upk-dark); margin-top: 10px; }
.validity-text { font-size: 11px; color: #888; }

/* --- ІНФО-БЛОК --- */
.custom-shape-box {
    background: #eef6ff; 
    border-left: 4px solid var(--upk-blue); 
    padding: 15px; 
    border-radius: 8px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.custom-shape-inner { display: flex; gap: 12px; align-items: flex-start; }
.custom-shape-icon { color: var(--upk-blue); font-size: 22px; flex-shrink: 0; margin-top: 2px; }
.custom-shape-text { font-size: 13px; font-weight: 500; color: #333; line-height: 1.4; }

/* --- АДАПТИВНІСТЬ --- */
@media (max-width: 992px) {
    .split-view { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .apple-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .header-details { text-align: left; }
    .flex-row { flex-direction: column; }
    
    .item-card { flex-wrap: wrap; padding-bottom: 20px; }
    .item-card canvas { display: none; }
    .item-info { flex: 1 1 100%; margin-top: 5px; }
    .item-price { flex: 1 1 100%; font-size: 16px; margin-top: 5px; text-align: left; color: var(--upk-blue); }
    .btn-remove { position: absolute; top: 10px; right: 10px; font-size: 20px; padding: 10px; }

    .messenger-buttons { grid-template-columns: 1fr; }
    .messenger-buttons .btn-apple-main { font-size: 14px; padding: 14px; }
}

@media print {
    .no-print { display: none !important; }
    .apple-container { max-width: 100%; padding: 0; }
    .apple-widget { box-shadow: none; border: 1px solid #eee; break-inside: avoid; }
    .item-card { break-inside: avoid; }
}