/**
 * Styles: Company Info - History Timeline
 *
 * Frontend component styles and admin UI styles.
 *
 * @package RIKAI_Marketing
 * @since 1.0.0
 */

/* ========================================
   SECTION CONTAINER
   ======================================== */

.company-infor-history {
    background: #ffffff;
    position: relative;
}

/* ========================================
   TIMELINE CONTAINER
   ======================================== */

.company-history--timeline {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

/* Vertical timeline line - Desktop */
@media (min-width: 992px) {
    .company-history--timeline::before {
        content: "";
        position: absolute;
        left: 10px;
        top: 0px;
        bottom: 0px;
        width: 2px;
        background: var(--secondary-border-color);
    }
}

/* Vertical timeline line - Tablet */
@media (min-width: 768px) and (max-width: 991px) {
    .company-history--timeline::before {
        content: "";
        position: absolute;
        left: 9px;
        top: 0px;
        bottom: 0px;
        width: 2px;
        background: var(--secondary-border-color);
    }
}

/* Vertical timeline line - Mobile */
@media (max-width: 767px) {
    .company-history--timeline::before {
        content: "";
        position: absolute;
        left: 7px; /* Align with col-4 center */
        top: 0px;
        bottom: 0px;
        width: 2px;
        background: var(--secondary-border-color);
    }
}

/* ========================================
   TIMELINE ITEM
   ======================================== */

.company-history--item {
    position: relative;
    display: flex;
    align-items: center;
}

.company-history--item:last-child {
    margin-bottom: 0;
}

/* ========================================
   LEFT SIDE: YEAR & MARKER
   ======================================== */
/* Timeline Marker (Dot) */
.company-history--marker {
    width: 20px;
    height: 20px;
    background: #3390d6;
    border-radius: 50%;
    z-index: 2;
}

.company-history--left {
    display: flex;
    gap: 40px;
    align-items: center;
    padding: 20px 20px 20px 40px;
    flex: 1;
}

.company-history--year {
    font-size: 26px;
    font-weight: 700;
    color: #3390d6;
    line-height: 1.2;
}

@media (max-width: 991px) {
    .company-history--year {
        font-size: 22px;
    }
}

@media (max-width: 767px) {
    .company-history--marker {
        width: 16px;
        height: 16px;
        border-width: 3px;
        box-shadow: 0 0 0 3px #3390d6;
    }

    .company-history--left {
        flex-direction: column;
        align-items: self-start;
        gap: 0px;
        padding: 15px 20px 15px 40px;
    }

    .company-history--content {
        padding-top: 0px;
    }
}

/* ========================================
   CENTER: CONTENT
   ======================================== */

.company-history--content {
    flex: 1;
    display: flex;
    flex-direction: column;
    letter-spacing: 3px;
}

@media (max-width: 767px) {
    .company-history--content {
    }
}

.company-history--item-title {
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.4;
}

@media (max-width: 767px) {
    .company-history--item-title {
        font-size: 16px;
    }
}

.company-history--description {
    font-size: 16px;
    color: #555555;
    line-height: 1.8;
    margin: 0;
}

@media (max-width: 767px) {
    .company-history--description {
        font-size: 14px;
        margin-top: 15px;
    }
}

/* ========================================
   RIGHT SIDE: IMAGE
   ======================================== */

.company-history--image {
    position: absolute;
    /* right: 0; */
    overflow: hidden;
    border-radius: 50%;
    max-width: 255px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.company-history--image-1 {
    right: 0;
    width: 255px;
    height: 255px;
}

.company-history--image-2 {
    right: 40%;
    width: 110px;
    height: 110px;
}

.company-history--image-3 {
    right: 30%;
    width: 133px;
    height: 133px;
}

.company-history--image-4 {
    right: 35%;
    top: -30px;
    width: 98px;
    height: 98px;
}
.company-history--image-5 {
    right: 5%;
    width: 219px;
    height: 219px;
}

@media (max-width: 1199px) {
    .company-history--image-1 {
        right: 0;
    }

    .company-history--image-2 {
        right: 30%;
    }

    .company-history--image-3 {
        right: 15%;
    }

    .company-history--image-4 {
        right: 20%;
        top: -30px;
    }
    .company-history--image-5 {
        right: 0;
    }
}

@media (max-width: 991px) {
    .company-history--image-1 {
        width: 200px;
        height: 200px;
        right: -20%;
    }

    .company-history--image-2 {
        width: 80px;
        height: 80px;
        right: 10%;
    }

    .company-history--image-3 {
        width: 100px;
        height: 100px;
        right: -10%;
    }

    .company-history--image-4 {
        width: 80px;
        height: 80px;
        right: 0%;
        top: 0;
    }
    .company-history--image-5 {
        width: 150px;
        height: 150px;
        right: -20%;
    }
}

@media (max-width: 767px) {
    .company-history--image-1 {
        width: 120px;
        height: 120px;
        right: 0%;
    }

    .company-history--image-2 {
        width: 66px;
        height: 66px;
        right: 55%;
        margin-top: -70px;
    }

    .company-history--image-3 {
        width: 60px;
        height: 60px;
        right: 10%;
        margin-top: 80px;
    }

    .company-history--image-4 {
        width: 46px;
        height: 46px;
        right: 0%;
        margin-top: 80px;
    }
    .company-history--image-5 {
        width: 59px;
        height: 59px;
        right: 4%;
        margin-top: -50px;
    }
}

@media (max-width: 567px) {
    .company-history--image-1 {
        right: 0%;
    }

    .company-history--image-2 {
        left: 195px;
        right: unset;
        margin-top: -80px;
    }

    .company-history--image-3 {
        right: 0px;
        margin-top: 100px;
    }

    .company-history--image-4 {
        right: -10%;
        margin-top: 60px;
    }
    .company-history--image-5 {
        right: -20px;
        margin-top: -70px;
    }
}

@media (max-width: 375px) {
    .company-history--image-1 {
        right: -20%;
    }

    .company-history--image-2 {
        left: unset;
        right: 20%;
        margin-top: -87px;
    }

    .company-history--image-3 {
        right: -7%;
        margin-top: 80px;
    }

    .company-history--image-4 {
        right: -5%;
        margin-top: 120px;
    }
    .company-history--image-5 {
        right: 4%;
        margin-top: -70px;
    }
}

.company-history--image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.company-history--image:hover img {
    transform: scale(1.05);
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 767px) {
    .company-history--item {
        margin-bottom: 0px;
    }
}

/* ========================================
   ANIMATION (OPTIONAL)
   ======================================== */

@media (prefers-reduced-motion: no-preference) {
    .company-history--item {
        opacity: 0;
        transform: translateY(20px);
        animation: fadeInUp 0.6s ease forwards;
    }

    .company-history--item:nth-child(1) {
        animation-delay: 0.1s;
    }
    .company-history--item:nth-child(2) {
        animation-delay: 0.2s;
    }
    .company-history--item:nth-child(3) {
        animation-delay: 0.3s;
    }
    .company-history--item:nth-child(4) {
        animation-delay: 0.4s;
    }
    .company-history--item:nth-child(5) {
        animation-delay: 0.5s;
    }
    .company-history--item:nth-child(n + 6) {
        animation-delay: 0.6s;
    }

    @keyframes fadeInUp {
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* ========================================
   ADMIN STYLES
   ======================================== */

/* ========================================
   GLOBAL CONTROLS
   ======================================== */

.history-timeline-controls {
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #f0f0f1;
    border-radius: 4px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.history-timeline-controls .button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.history-timeline-controls .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ========================================
   ROW LAYOUT
   ======================================== */

.history-item-row {
    position: relative;
    margin-bottom: 25px;
    padding: 0;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.history-item-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #c3c4c7;
}

/* Row header */
.history-item-row > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9f9f9;
    border-radius: 8px 8px 0 0;
    margin: 0 !important;
}

.history-item-row.is-collapsed > div:first-child {
    border-radius: 8px;
}

/* Row title */
.history-item-row h4 {
    margin: 0 !important;
    color: #3390d6;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.history-item-row h4 .dashicons {
    color: #3390d6;
}

.history-item-row.is-collapsed h4 {
    color: #50575e;
}

.history-item-label {
    font-weight: 700;
    max-width: 500px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   UNIFIED ACTION BUTTONS
   All buttons share the same base style
   ======================================== */

.history-action-btn {
    /* Layout */
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;

    /* Dimensions */
    height: 36px !important;
    padding: 0 12px !important;
    min-width: auto !important;

    /* Typography */
    font-size: 13px;
    font-weight: 500;
    line-height: 1;

    /* Appearance */
    background: #f0f0f1 !important;
    border: 1px solid #c3c4c7 !important;
    border-radius: 6px;
    color: #2c3338 !important;

    /* Interaction */
    cursor: pointer;
    transition: all 0.2s ease;

    /* Reset */
    box-shadow: none !important;
}

.history-action-btn:hover {
    background: #dcdcde !important;
    border-color: #a7aaad !important;
    color: #1d2327 !important;
}

.history-action-btn:focus {
    outline: 2px solid #2271b1 !important;
    outline-offset: 1px;
    box-shadow: none !important;
}

.history-action-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    margin: 0 !important;
}

/* Button text */
.history-btn-text {
    display: inline-block;
    white-space: nowrap;
}

/* ========================================
   SPECIFIC BUTTON VARIANTS
   ======================================== */

/* Move Up button */
.history-move-up:hover {
    background: #2271b1 !important;
    border-color: #2271b1 !important;
    color: #fff !important;
}

.history-move-up:hover .dashicons {
    color: #fff;
}

/* Move Down button */
.history-move-down:hover {
    background: #2271b1 !important;
    border-color: #2271b1 !important;
    color: #fff !important;
}

.history-move-down:hover .dashicons {
    color: #fff;
}

/* Collapse/Expand button */
.history-row-toggle.is-expanded .dashicons {
    color: #2271b1;
}

.history-row-toggle.is-collapsed .dashicons {
    color: #3c434a;
}

/* Remove button */
.history-remove {
    background: #fff !important;
    border-color: #d63333 !important;
    color: #d63333 !important;
}

.history-remove:hover {
    background: #d63333 !important;
    border-color: #d63333 !important;
    color: #fff !important;
}

.history-remove:hover .dashicons {
    color: #fff;
}

.history-remove:focus {
    outline-color: #d63333 !important;
}

/* ========================================
   DISABLED BUTTON STATES
   ======================================== */

/* First item - Move Up disabled */
.history-item-row:first-child .history-move-up {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Last item - Move Down disabled */
.history-item-row:last-child .history-move-down {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
   ACTION BUTTONS CONTAINER
   ======================================== */

.history-item-row > div:first-child > div:last-child {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* ========================================
   ROW CONTENT (COLLAPSIBLE)
   ======================================== */

.history-row-content {
    padding: 20px;
    overflow: hidden;
}

.history-item-row.is-collapsed .history-row-content {
    display: none;
}

/* ========================================
   MOVE FEEDBACK ANIMATION
   ======================================== */

@keyframes historyRowFlash {
    0% {
        background-color: #e8f4fd;
        border-color: #3390d6;
        transform: scale(1.01);
    }
    100% {
        background-color: #fff;
        border-color: #dcdcde;
        transform: scale(1);
    }
}

.history-row-moved {
    animation: historyRowFlash 0.3s ease;
}

/* ========================================
   COLLAPSED STATE
   ======================================== */

.history-item-row.is-collapsed {
    background: #f6f7f7;
}

.history-item-row.is-collapsed > div:first-child {
    background: #f0f0f1;
}

/* ========================================
   ANIMATIONS
   ======================================== */

.history-row-content {
    transition: all 0.2s ease;
}

.history-item-row {
    transition: all 0.2s ease;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media screen and (max-width: 782px) {
    .history-timeline-controls {
        flex-wrap: wrap;
    }

    .history-item-row > div:first-child {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .history-item-row > div:first-child > div:last-child {
        width: 100%;
        justify-content: flex-start;
    }

    .history-item-label {
        max-width: 100%;
        font-size: 13px;
    }

    /* Stack buttons on small screens */
    .history-action-btn {
        flex: 1;
        min-width: 0;
        font-size: 12px;
    }

    .history-btn-text {
        display: none; /* Hide text on mobile, show icons only */
    }

    .history-action-btn {
        padding: 0 10px !important;
        justify-content: center;
    }
}

@media screen and (min-width: 783px) and (max-width: 1200px) {
    /* Medium screens - shorter button text */
    .history-btn-text {
        font-size: 12px;
    }

    .history-action-btn {
        padding: 0 10px !important;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .history-timeline-controls,
    .history-action-btn {
        display: none !important;
    }

    .history-item-row {
        background: #fff !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .history-row-content {
        display: block !important;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.history-action-btn:focus-visible {
    outline: 2px solid #2271b1 !important;
    outline-offset: 2px;
}

/* Ensure sufficient contrast */
.history-action-btn {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   CLEANUP - REMOVE OLD STYLES
   These styles should NOT exist anymore
   ======================================== */

/* NO drag handle styles */
.history-item-drag-handle,
.drag-handle,
.sortable-handle {
    display: none !important; /* Ensure old drag handles are hidden */
}

/* NO sortable placeholder */
.history-sortable-placeholder,
.ui-sortable-placeholder {
    display: none !important;
}

/* NO old remove button class */
.remove-history-item {
    /* Replaced with .history-remove */
}
