/**
 * Mayak Landing - Main Stylesheet
 * Based on Tilda Design System extracted from mayak.bz/analize
 *
 * Design System Reference: /docs/DESIGN_SYSTEM.md
 */

/* ==========================================================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ========================================================================== */

:root {
    /* Colors - Primary Palette */
    --color-primary-dark: #383540;
    --color-white: #ffffff;
    --color-accent-yellow: #ffc700;
    --color-cream: #f9eec8;
    --color-light-gray: #f6f4f5;
    --color-text: #423f4a;
    --color-text-muted: rgba(66, 63, 74, 0.8);
    --color-link: #005bff;
    --color-error: #FF3503;

    /* Background */
    --color-bg-page: #F7F8FA;
    --color-bg-card: #ffffff;

    /* Shadows */
    --shadow-card: 2px 0px 30px 0px rgba(56, 53, 64, 0.2);
    --shadow-card-light: 2px 0px 30px 0px rgba(56, 53, 64, 0.1);
    --shadow-footer: 0 10px 40px rgba(0, 0, 0, 0.08);

    /* Border Radius */
    --radius-card: 20px;
    --radius-button: 12px;
    --radius-pill: 15px;
    --radius-circle: 50%;
    --radius-badge: 60px;

    /* Spacing (8px base grid) */
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 20px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 40px;
    --space-3xl: 48px;
    --space-4xl: 60px;
    --space-5xl: 80px;

    /* Typography */
    --font-primary: 'ONYOneBeta', 'Manrope', 'Montserrat', sans-serif;
    --font-heading: 'ONYOneBeta', 'Manrope', sans-serif;
    --font-body: 'ONYOneBeta', 'Manrope', sans-serif;

    /* Font sizes */
    --text-hero: 120px;
    --text-large: 80px;
    --text-xlarge: 70px;
    --text-h1: 46px;
    --text-h2: 32px;
    --text-h3: 26px;
    --text-body-lg: 24px;
    --text-body: 22px;
    --text-body-sm: 20px;
    --text-small: 18px;
    --text-xs: 16px;
    --text-xxs: 14px;

    /* Line heights */
    --leading-tight: 1.1;
    --leading-snug: 1.15;
    --leading-normal: 1.4;
    --leading-relaxed: 1.5;

    /* Transitions */
    --transition-fast: 0.2s ease-in-out;
    --transition-medium: 0.3s ease-in-out;
    --transition-slow: 0.5s ease-in-out;

    /* Container widths */
    --container-max: 1200px;
    --container-content: 800px;
}

/* ==========================================================================
   FONT FACES
   ========================================================================== */

@font-face {
    font-family: 'ONYOneBeta';
    src: url('fonts/ONYOneBeta-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'ONYOneBeta';
    src: url('fonts/ONYOneBeta-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'ONYOneBeta';
    src: url('fonts/ONYOneBeta-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

/* ==========================================================================
   CSS RESET
   ========================================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
}

body {
    background-color: #F7F8FA;
    color: #383540;
    display: block;
    /* Restored to block for full-width Tilda strips */
    padding: 0;
    margin: 0;
    min-height: 100vh;
}

.main-container {
    padding: 40px 20px;
    background-color: transparent;
    width: 100%;
    max-width: 1200px;
    flex: 1;
}

.main-container {
    background-color: transparent;
    width: 100%;
    max-width: 1200px;
    padding: 0;
}

/* Header */
.header {
    margin-bottom: 40px;
}

.logo {
    font-family: 'ONYOneBeta', 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #383540;
}

/* Input Section */
.input-section {
    margin-bottom: 60px;
    max-width: 800px;
}

h1 {
    font-family: 'ONYOneBeta', 'Manrope', sans-serif;
    font-size: 46px;
    font-weight: 500;
    line-height: 1.15;
    margin-bottom: 25px;
    color: #423F4A;
}

/* Store title - prevent wrap */
#store-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media screen and (max-width: 768px) {
    #store-title {
        font-size: 28px;
    }
}

@media screen and (max-width: 480px) {
    #store-title {
        font-size: 22px;
    }
}

.input-wrapper {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    background: white;
    padding: 10px;
    border-radius: 20px;
    box-shadow: 2px 0px 30px 0px rgba(56, 53, 64, 0.1);
}

input[type="text"] {
    flex-grow: 1;
    padding: 15px 20px;
    border: none;
    font-size: 18px;
    outline: none;
    background: transparent;
    color: #383540;
    font-family: 'ONYOneBeta', 'Manrope', sans-serif;
}

button {
    background-color: #383540;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-family: 'ONYOneBeta', 'Manrope', sans-serif;
    font-weight: 600;
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.2s;
}

button:hover {
    transform: scale(1.02);
}

#loading {
    color: #666;
    font-size: 16px;
    margin-top: 15px;
    margin-left: 10px;
}

#error-msg {
    color: #FF3503;
    font-size: 16px;
    margin-top: 15px;
}

.hidden {
    display: none !important;
}

/* Dashboard Layout */
background-color: #FFFFFF;
padding: 15px 40px;
border-radius: 60px;
font-family: 'ONYOneBeta',
'Manrope',
sans-serif;
font-size: 32px;
font-weight: 500;
color: #423F4A;
margin-bottom: 40px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);

.results-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* Row containers */
.row {
    display: flex;
    gap: 20px;
}

.card {
    border-radius: 20px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 2px 0px 30px 0px rgba(56, 53, 64, 0.2);
    min-height: 180px;
    position: relative;
    overflow: visible;
    /* Allow box to overflow */
}

.card-title {
    font-family: 'ONYOneBeta', 'Manrope', sans-serif;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 400;
    opacity: 0.9;
    margin-bottom: 10px;
    z-index: 2;
}

.card-value {
    font-family: 'ONYOneBeta', 'Manrope', sans-serif;
    font-weight: 500;
    line-height: 1;
    z-index: 2;
}

.huge-value {
    font-size: 120px;
    color: #FFC700;
}

.big-value {
    font-size: 80px;
}

.white-text {
    color: white;
}

/* Colors */
.dark-card {
    background-color: #383540;
    color: white;
}

.light-yellow-card {
    background-color: #F9EEC8;
    color: #383540;
}

/* === MAIN PROBLEMS ROW WITH BOX === */
.problems-row {
    display: flex;
    gap: 20px;
    position: relative;
}

.problems-card {
    flex: 1;
    background-color: #383540;
    color: white;
    min-height: 220px;
    position: relative;
    overflow: visible;
}

/* Box positioned to overlap the card */
.box-container {
    position: absolute;
    right: -50px;
    /* Overlap outside */
    top: 50%;
    transform: translateY(-50%);
    width: 480px;
    z-index: 10;
}

.box-image {
    width: 100%;
    height: auto;
    display: block;
}

.alert-icon-img {
    position: absolute;
    top: -40px;
    left: 40px;
    width: 90px;
    height: auto;
    z-index: 20;
    transform: rotate(-10deg);
}

/* Middle rows */
.middle-row,
.bottom-row {
    display: flex;
    gap: 20px;
}

.middle-row .card:first-child {
    flex: 1.2;
}

.middle-row .card:last-child {
    flex: 1;
}

.bottom-row .card:first-child {
    flex: 1;
}

.bottom-row .card:last-child {
    flex: 1.2;
}

/* === MOBILE STYLES === */
@media (max-width: 900px) {
    body {
        padding: 20px 10px;
    }

    h1 {
        font-size: 28px;
    }

    .store-badge {
        font-size: 18px;
        padding: 8px 16px;
    }

    .input-wrapper {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .problems-row,
    .middle-row,
    .bottom-row {
        flex-direction: column;
    }

    /* Move the box INSIDE the card on mobile */
    .problems-card {
        display: flex;
        flex-direction: row;
        align-items: flex-end;
        padding: 30px;
        min-height: 180px;
    }

    .problems-card .card-content {
        flex: 1;
    }

    .box-container {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        width: 150px;
        margin-left: auto;
        align-self: center;
    }

    .alert-icon-overlay {
        width: 50px;
        height: 50px;
        font-size: 30px;
        top: -10px;
        left: 10px;
    }

    .huge-value {
        font-size: 70px;
    }

    .big-value {
        font-size: 50px;
    }

    .card {
        padding: 25px;
        min-height: 140px;
    }

    .card-title {
        font-size: 20px;
    }
}

/* Diagnostics Block */
.diag-block {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    margin-left: 20px;
}

.diag-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
}

.diag-title {
    font-family: 'ONYOneBeta', 'Manrope', sans-serif;
    font-size: 32px;
    font-weight: 500;
    color: #423F4A;
}

/* ==========================================================================
   TILDA DIAGNOSTICS CARDS (rec1781974591) - Original Tilda Sizing
   ========================================================================== */

/* Main card title - "Диагностика по карточкам" */
#rec1781974591 .tn-elem__17819745911768451885078000007 .tn-atom {
    font-size: 32px;
    font-weight: 500;
    line-height: 1.15;
}

/* Labels: "Название", "Артикул" */
#rec1781974591 [field="tn_text_1768451985590000028"],
#rec1781974591 [field="tn_text_1768316418635000006"] {
    font-size: 22px;
    font-weight: 400;
}

/* Values: Product name, Article number */
#rec1781974591 [field="tn_text_1768458977059000001"],
#rec1781974591 [field="tn_text_1768316418635000004"] {
    font-size: 22px;
    font-weight: 400;
}

/* "Статистика" section header */
#rec1781974591 [field="tn_text_1749976768693"] {
    font-size: 24px;
    font-weight: 500;
}

/* Stats labels: "Маржинальность", "CTR", "Сумм. заказов за период" */
#rec1781974591 [field="tn_text_1768452165602000004"],
#rec1781974591 [field="tn_text_1768452099898000002"],
#rec1781974591 [field="tn_text_1768452112798000003"] {
    font-size: 22px;
    font-weight: 400;
}

/* Stats values: prices, percentages */
#rec1781974591 [field="tn_text_1768452191946000005"],
#rec1781974591 [field="tn_text_1768452394123000003"],
#rec1781974591 [field="tn_text_1768452453697000006"] {
    font-size: 22px;
    font-weight: 400;
}

/* Change indicators with +/- */
#rec1781974591 [field="tn_text_1768452081658000001"],
#rec1781974591 [field="tn_text_1768452394123000002"],
#rec1781974591 [field="tn_text_1768452453697000005"] {
    font-size: 22px;
    font-weight: 500;
}

/* "Проблема:" / "Причина:" labels */
#rec1781974591 [field="tn_text_1768316418635000015"],
#rec1781974591 [field="tn_text_1768316418635000011"] {
    font-size: 22px;
    font-weight: 500;
}

/* Problem/Cause descriptions */
#rec1781974591 [field="tn_text_1768316418635000014"],
#rec1781974591 [field="tn_text_1768316418635000010"] {
    font-size: 22px;
    font-weight: 400;
    line-height: 1.4;
}

/* Responsive adjustments for diagnostic cards */
@media screen and (max-width: 960px) {
    #rec1781974591 .tn-elem__17819745911768451885078000007 .tn-atom {
        font-size: 32px;
    }

    #rec1781974591 [field] {
        font-size: 20px;
    }
}

@media screen and (max-width: 640px) {
    #rec1781974591 .tn-elem__17819745911768451885078000007 .tn-atom {
        font-size: 28px;
    }

    #rec1781974591 [field] {
        font-size: 18px;
    }
}

@media screen and (max-width: 480px) {
    #rec1781974591 .tn-elem__17819745911768451885078000007 .tn-atom {
        font-size: 20px;
    }

    #rec1781974591 [field] {
        font-size: 16px;
    }
}

/* Footer - using specific class to avoid Tilda conflicts */
.mayak-footer {
    background-color: #000000;
    color: #999;
    padding: 80px 20px;
    margin-top: 80px;
    width: 100%;
    display: flex;
    justify-content: center;
    font-family: 'Manrope', sans-serif;
    font-weight: 400;
}

.footer-content {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: 250px 1fr 1fr 200px;
    gap: 30px;
    margin-bottom: 40px;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.footer-logo-img {
    height: 34px;
    margin-bottom: 20px;
}

.footer-socials {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.social-icon {
    width: 32px;
    height: 32px;
    opacity: 1;
    transition: opacity 0.2s;
}

.social-icon:hover {
    opacity: 0.8;
}

.footer-links {
    padding-top: 5px;
}

.footer-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links-list li {
    margin-bottom: 12px;
}

.footer-links-list a {
    color: #DDDDDD;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.5;
    transition: color 0.2s;
}

.footer-links-list a:hover {
    color: white;
}

.footer-partners {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: flex-start;
}

.partner-logo-group {
    margin-bottom: 10px;
}

.partner-logo {
    height: auto;
    width: 140px;
    object-fit: contain;
    opacity: 1;
    margin-bottom: 5px;
}

/* Partner Headers */
.partner-header {
    font-size: 14px;
    color: #666;
    margin-top: 20px;
    margin-bottom: 10px;
}

.footer-bottom {
    max-width: 1200px;
    width: 100%;
    border-top: 1px solid #222;
    padding-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 40px;
}

.footer-text {
    font-size: 12px;
    line-height: 1.6;
    color: #555;
    max-width: 900px;
}

.footer-text a {
    color: #555;
    text-decoration: underline;
}

@media (max-width: 1024px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

@media (max-width: 900px) {
    .diag-title {
        font-size: 24px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 60px;
    }
}

/* ==========================================================================
   RISK TABLE & DIAGNOSTICS
   ========================================================================== */

/* Risk Table */
.risk-table-container {
    width: 100%;
    margin-top: 20px;
    background: #FFFFFF;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 2px 0px 30px 0px rgba(56, 53, 64, 0.1);
}

.risk-table {
    width: 100%;
    border-collapse: collapse;
}

.risk-table th {
    text-align: left;
    padding: 20px 30px;
    background-color: #F7F8FA;
    color: #423F4A;
    font-weight: 500;
    font-size: 18px;
    border-bottom: 1px solid #EAEAEA;
}

.risk-table td {
    padding: 20px 30px;
    border-bottom: 1px solid #EAEAEA;
    font-size: 18px;
    color: #383540;
    vertical-align: top;
}

.risk-table tr:last-child td {
    border-bottom: none;
}

.risk-condition {
    font-weight: 500;
    width: 40%;
}

.risk-description {
    color: #FF3503;
    /* Accent color for risk text */
}

/* Diagnostic Cards */
.diagnostic-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.diag-card {
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 2px 0px 30px 0px rgba(56, 53, 64, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: row;
}

.diag-img-container {
    width: 250px;
    min-width: 250px;
    background: #F7F8FA;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.diag-img {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 10px;
}

.diag-content {
    flex: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.diag-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.diag-title-text {
    font-size: 22px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #383540;
}

.diag-article {
    font-size: 14px;
    color: #999;
}

.diag-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    background: #F9EEC8;
    /* Cream/Yellowish bg from design */
    padding: 20px;
    border-radius: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 14px;
    color: rgba(56, 53, 64, 0.6);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: #383540;
}

.diag-problems {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.problem-box {
    flex: 1;
    min-width: 280px;
    background: #383540;
    color: #FFFFFF;
    padding: 20px;
    border-radius: 15px;
}

.cause-box {
    flex: 1;
    min-width: 280px;
    background: #FFC700;
    /* Accent Yellow */
    color: #383540;
    padding: 20px;
    border-radius: 15px;
}

.box-title {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 10px;
    display: block;
}

.box-text {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.3;
}

/* Articles Table */
.articles-table-wrapper {
    margin-top: 40px;
    width: 100%;
    background: white;
    padding: 30px;
    border-radius: 20px;
}

@media (max-width: 900px) {
    .diag-card {
        flex-direction: column;
    }

    .diag-img-container {
        width: 100%;
        height: 250px;
    }

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

    .diag-problems {
        flex-direction: column;
    }
}

/* Fix for interfering element in header */
/* Logo visibility restored */

/* Responsive Styles for Refactored Header & Stats */
@media screen and (max-width: 768px) {
    .t396__artboard {
        padding: 40px 15px !important;
    }

    .main-header h1 {
        font-size: 32px !important;
    }

    .main-header div {
        font-size: 18px !important;
    }

    #val-drr,
    #val-campaigns {
        font-size: 60px !important;
    }

    #val-wasted {
        font-size: 50px !important;
    }

    .stat-card {
        padding: 20px !important;
        min-height: 160px !important;
    }

    .stat-card div:first-child {
        font-size: 20px !important;
    }
}