/* Smart Messages Frontend Styles */

.smart-messages-container {
    width: 100%; /* Full bredde for container */
    margin: 20px 0;
    position: relative;
    text-align: center; /* Sentrering av containerinnhold */
}

.smart-message {
    display: block; /* Full bredde for meldingen */
    width: 100%; /* Full bredde */
    margin: 15px 0;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    text-align: center; /* Sentrering av meldinginnhold */
    position: relative; /* For å posisjonere dismiss-knappen */
}

.smart-message.dismissible {
    padding-right: 50px; /* Plass til dismiss-knappen */
}

/* Layout Variations */
.smart-message.layout-box {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    width: 100%; /* Sikrer full bredde for layout-box */
}

.smart-message.layout-banner {
    border-radius: 0;
    margin: 0 -20px 20px -20px;
    padding: 15px 40px;
    border-left: 4px solid rgba(0, 0, 0, 0.2);
    width: 100%; /* Sikrer full bredde for layout-banner */
}

.smart-message.layout-card {
  --s: 1.8em; /* båndets størrelse */
  --d: .8em;  /* dybden */
  --c: .8em;  /* cutout */

  font-size: 20px;
  font-weight: bold;
  color: #fff;
  text-align: center;

  /* jevn padding oppe og nede for luft */
  padding: calc(var(--d) + 16px) calc(var(--s) + 1em) 16px;

  line-height: 1.6;
  display: flex;
  align-items: center;   /* vertikalt midtstilt */
  justify-content: center; /* horisontalt midtstilt */
  text-align: center;

  background:
    conic-gradient(from  45deg at left  var(--s) top var(--d),
     #0008 12.5%,#0000 0 37.5%,#0004 0) 0   /50% 100% no-repeat,
    conic-gradient(from -45deg at right var(--s) top var(--d),
     #0004 62.5%,#0000 0 87.5%,#0008 0) 100%/50% 100% no-repeat;

  clip-path: polygon(
    0 0,
    calc(var(--s) + var(--d)) 0,
    calc(var(--s) + var(--d)) var(--d),
    calc(100% - var(--s) - var(--d)) var(--d),
    calc(100% - var(--s) - var(--d)) 0,
    100% 0,
    calc(100% - var(--c)) calc(50% - var(--d)/2),
    100% calc(100% - var(--d)),
    calc(100% - var(--s)) calc(100% - var(--d)),
    calc(100% - var(--s)) 100%,
    var(--s) 100%,
    var(--s) calc(100% - var(--d)),
    0 calc(100% - var(--d)),
    var(--c) calc(50% - var(--d)/2)
  );

  background-color: var(--sm-bg, #D95B43);
  margin: 25px auto; /* luft over og under hele ribbon */
  width: fit-content;
}



/* Placement Specific Styles */
.smart-message.placement-home_top {
    margin-bottom: 30px;
    width: 100%; /* Sikrer full bredde for topp */
}

.smart-message.placement-cart,
.smart-message.placement-checkout {
    margin: 20px 0;
    width: 100%; /* Sikrer full bredde */
}

.smart-message.placement-footer {
    margin: 10px 0;
    font-size: 14px;
    padding-right: 50px; /* Plass til dismiss-knapp på footer */
    width: 100%; /* Sikrer full bredde for footer */
    position: relative; /* Sørger for at dismiss-posisjonering fungerer */
}

/* Message Content */
.smart-message-content {
    display: flex;
    flex-direction: column; /* Stabler tittel og body vertikalt */
    align-items: center; /* Sentrering av innhold */
    gap: 1px; /* 1px mellomrom mellom tittel og tekst */
    width: 100%; /* Sikrer at innholdet tar full bredde */
}

.smart-message-icon {
    flex-shrink: 0;
    font-size: 24px;
    line-height: 1;
    margin-top: 2px;
    text-align: center; /* Sentrering av ikon */
}

.smart-message-icon svg {
    width: 24px;
    height: 24px;
    vertical-align: top;
}

.smart-message-body {
    flex: 1;
    text-align: center; /* Sentrering av body-tekst */
    width: 100%; /* Sikrer full bredde */
}

.smart-message-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center; /* Sentrering av tittel */
    width: 100%; /* Sikrer full bredde */
}

.placement-footer .smart-message-title {
    font-size: 16px;
}

.smart-message-body p {
    margin: 0;
    line-height: 1.5;
    text-align: center; /* Sentrering av hvert avsnitt */
    width: 100%; /* Sikrer full bredde */
}

.smart-message-body p:last-child {
    margin-bottom: 0;
}

/* Dismiss Button */
.smart-message-dismiss {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smart-message-dismiss:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1);
}

.smart-message-dismiss:focus {
    outline: 2px solid rgba(0, 0, 0, 0.3);
    outline-offset: 2px;
}

/* Animations */
.smart-message {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.smart-message.dismissing {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 200px;
        margin-bottom: 15px;
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
}

/* Fallback Messages */
.smart-messages-fallback {
    padding: 15px;
    margin: 15px 0;
    background-color: #f9f9f9;
    border: 1px dashed #ccc;
    border-radius: 4px;
    color: #666;
    font-style: italic;
    text-align: center;
    width: 100%; /* Sikrer full bredde */
}

/* Responsive Design */
@media (max-width: 768px) {
    .smart-message {
        margin: 10px 0;
        padding: 15px;
        font-size: 14px;
        width: 100%; /* Sikrer full bredde på mobile */
    }
    
    .smart-message.layout-banner {
        margin: 0 -15px 15px -15px;
        padding: 12px 35px 12px 20px;
        width: 100%; /* Sikrer full bredde */
    }
    
    .smart-message-content {
        gap: 1px; /* 1px mellomrom på mobile */
        width: 100%; /* Sikrer full bredde */
    }
    
    .smart-message-icon {
        font-size: 20px;
    }
    
    .smart-message-title {
        font-size: 16px;
    }
    
    .placement-footer .smart-message-title {
        font-size: 14px;
    }
    
    .smart-message-dismiss {
        top: 8px;
        right: 8px;
        width: 24px;
        height: 24px;
        font-size: 18px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .smart-message {
        border: 2px solid;
    }
    
    .smart-message-dismiss {
        border: 1px solid;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .smart-message,
    .smart-message.dismissing,
    .smart-message-dismiss {
        animation: none;
        transition: none;
    }
}

/* Print Styles */
@media print {
    .smart-message-dismiss {
        display: none;
    }
    
    .smart-message {
        box-shadow: none;
        border: 1px solid #000;
    }
}