/* ============================================
   licensor.directory - Styles
   Corporate-Playful Horizontal Directory
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f8faf8;
    --card-surface: #ffffff;
    --primary-green: #2a8c5a;
    --complementary-coral: #c45a4a;
    --leaf-organic: #4aac6a;
    --text-primary: #1a2a20;
    --text-secondary: #5a7a60;
    --card-border: rgba(42, 140, 90, 0.2);
    --shadow-3d: rgba(26, 74, 48, 0.15); /* #1a4a30 */
    --deep-forest: #1a4a30;
    --overlay-bg: rgba(255, 255, 255, 0.95);
    --panel-width: 280px;
    --footer-height: 52px;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
}

/* --- Fixed Left Panel --- */
#left-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--panel-width);
    height: 100vh;
    background: var(--card-surface);
    border-right: 1px solid var(--card-border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px var(--shadow-3d);
}

.panel-content {
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.directory-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(24px, 4vw, 48px);
    color: var(--primary-green);
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

/* --- Leaf Cluster Decorations --- */
.leaf-cluster {
    position: relative;
    width: 120px;
    height: 80px;
    margin: 0 auto 32px auto;
}

.leaf {
    position: absolute;
    width: 40px;
    height: 18px;
    border-radius: 50% 0 50% 0;
    opacity: 0;
    animation: leafFadeIn 400ms ease-out forwards;
}

.leaf-1 {
    background: var(--primary-green);
    top: 10px;
    left: 10px;
    transform: rotate(-20deg);
    animation-delay: 0ms;
}

.leaf-2 {
    background: var(--leaf-organic);
    top: 5px;
    left: 40px;
    transform: rotate(15deg);
    animation-delay: 80ms;
}

.leaf-3 {
    background: rgba(42, 140, 90, 0.6);
    top: 25px;
    left: 30px;
    transform: rotate(-5deg);
    animation-delay: 160ms;
}

.leaf-4 {
    background: var(--leaf-organic);
    top: 30px;
    left: 60px;
    transform: rotate(30deg);
    animation-delay: 240ms;
}

.leaf-5 {
    background: rgba(74, 172, 106, 0.7);
    top: 15px;
    left: 70px;
    transform: rotate(-25deg);
    animation-delay: 320ms;
}

@keyframes leafFadeIn {
    0% {
        opacity: 0;
        transform: translateX(-8px) rotate(var(--rot, 0deg));
    }
    60% {
        opacity: 1;
        transform: translateX(4px) rotate(var(--rot, 0deg));
    }
    100% {
        opacity: 1;
        transform: translateX(0) rotate(var(--rot, 0deg));
    }
}

.leaf-1 { --rot: -20deg; }
.leaf-2 { --rot: 15deg; }
.leaf-3 { --rot: -5deg; }
.leaf-4 { --rot: 30deg; }
.leaf-5 { --rot: -25deg; }

/* --- Category Navigation --- */
.category-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.category-filter {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: all 200ms ease;
}

.category-filter:hover {
    color: var(--primary-green);
    background: rgba(42, 140, 90, 0.06);
}

.category-filter.active {
    color: var(--card-surface);
    background: var(--primary-green);
    border-color: var(--primary-green);
}

/* --- Horizontal Gallery --- */
#gallery-container {
    position: fixed;
    top: 0;
    left: var(--panel-width);
    right: 0;
    bottom: var(--footer-height);
    overflow: hidden;
}

#gallery-scroll {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 100%;
    padding: 40px 40px 40px 40px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#gallery-scroll::-webkit-scrollbar {
    display: none;
}

#gallery-scroll {
    scrollbar-width: none;
}

/* --- Licensor Cards --- */
.licensor-card {
    flex: 0 0 280px;
    width: 280px;
    height: 400px;
    background: var(--card-surface);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 200ms ease,
                box-shadow 300ms ease;
    box-shadow: 0 4px 16px var(--shadow-3d),
                0 1px 4px rgba(26, 74, 48, 0.08);
    overflow: hidden;
    opacity: 0;
    transform: scale(0.95);
}

.licensor-card.visible {
    opacity: 1;
    transform: scale(1);
}

.licensor-card:hover {
    transform: scale(1.03);
    border-color: var(--complementary-coral);
    box-shadow: 0 8px 32px var(--shadow-3d),
                0 2px 8px rgba(26, 74, 48, 0.12);
}

.licensor-card.card-active {
    border-color: var(--complementary-coral);
    border-width: 2px;
}

/* --- Card Icon (3D CSS) --- */
.card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    position: relative;
}

/* Certificate Icon */
.icon-certificate .cert-body {
    width: 40px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-green), var(--leaf-organic));
    border-radius: 6px;
    position: absolute;
    top: 0;
    left: 0;
    box-shadow: 2px 3px 0 rgba(26, 74, 48, 0.3),
                inset 0 -2px 4px rgba(0, 0, 0, 0.1),
                inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.icon-certificate .cert-seal {
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at 40% 40%, var(--complementary-coral), #a04030);
    border-radius: 50%;
    position: absolute;
    bottom: 0;
    right: 0;
    box-shadow: 1px 2px 0 rgba(26, 74, 48, 0.2),
                inset 0 1px 3px rgba(255, 255, 255, 0.3);
}

/* Key Icon */
.icon-key .key-head {
    width: 22px;
    height: 22px;
    border: 4px solid var(--primary-green);
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    box-shadow: 2px 2px 0 rgba(26, 74, 48, 0.25);
    background: radial-gradient(circle at 40% 40%, rgba(74, 172, 106, 0.3), transparent);
}

.icon-key .key-shaft {
    width: 26px;
    height: 6px;
    background: linear-gradient(180deg, var(--leaf-organic), var(--primary-green));
    border-radius: 3px;
    position: absolute;
    top: 16px;
    left: 18px;
    box-shadow: 1px 2px 0 rgba(26, 74, 48, 0.2);
}

.icon-key .key-teeth {
    position: absolute;
    top: 22px;
    left: 34px;
    width: 8px;
    height: 10px;
    background: var(--primary-green);
    border-radius: 0 0 2px 2px;
    box-shadow: 1px 1px 0 rgba(26, 74, 48, 0.2);
}

/* Shield Icon */
.icon-shield .shield-body {
    width: 36px;
    height: 42px;
    background: linear-gradient(150deg, var(--primary-green), var(--deep-forest));
    clip-path: polygon(50% 0%, 100% 15%, 100% 65%, 50% 100%, 0% 65%, 0% 15%);
    position: absolute;
    top: 2px;
    left: 4px;
    box-shadow: 2px 3px 0 rgba(26, 74, 48, 0.3);
}

.icon-shield .shield-body::after {
    content: '';
    position: absolute;
    inset: 4px;
    background: linear-gradient(150deg, var(--leaf-organic), var(--primary-green));
    clip-path: polygon(50% 0%, 100% 15%, 100% 65%, 50% 100%, 0% 65%, 0% 15%);
}

.icon-shield .shield-check {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 16px;
    height: 10px;
    border-left: 3px solid var(--card-surface);
    border-bottom: 3px solid var(--card-surface);
    transform: rotate(-45deg);
    z-index: 1;
}

/* --- Card Content --- */
.card-category {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary-green);
    margin-bottom: 8px;
}

.card-name {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

.card-description {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1.4vw, 17px);
    line-height: 1.6;
    color: var(--text-secondary);
    flex: 1;
}

.card-meta {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--card-border);
}

.meta-item {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

/* --- Card Leaf Decoration --- */
.card-leaf-decoration {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 60px;
    height: 40px;
    opacity: 0.3;
}

.leaf-sm {
    width: 24px;
    height: 10px;
    border-radius: 50% 0 50% 0;
}

.leaf-sm-1 {
    background: var(--leaf-organic);
    position: absolute;
    bottom: 12px;
    right: 8px;
    transform: rotate(20deg);
}

.leaf-sm-2 {
    background: var(--primary-green);
    position: absolute;
    bottom: 4px;
    right: 20px;
    transform: rotate(-10deg);
}

.leaf-sm-3 {
    background: rgba(74, 172, 106, 0.6);
    position: absolute;
    bottom: 18px;
    right: 28px;
    transform: rotate(35deg);
}

/* --- Skeleton Loading --- */
.licensor-card.skeleton {
    pointer-events: none;
}

.licensor-card.skeleton .card-icon,
.licensor-card.skeleton .card-category,
.licensor-card.skeleton .card-name,
.licensor-card.skeleton .card-description,
.licensor-card.skeleton .card-meta {
    background: linear-gradient(90deg, rgba(74, 172, 106, 0.1) 25%, rgba(74, 172, 106, 0.2) 50%, rgba(74, 172, 106, 0.1) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: 8px;
    color: transparent;
}

.licensor-card.skeleton .card-icon * {
    visibility: hidden;
}

@keyframes skeletonPulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Scroll Progress Track --- */
#scroll-progress-track {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(42, 140, 90, 0.1);
}

#scroll-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-green), var(--complementary-coral));
    transition: width 100ms ease;
}

/* --- Detail Overlay --- */
#overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 42, 32, 0.3);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

#overlay-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

#detail-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: var(--overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 300;
    transform: translateX(100%);
    transition: transform 300ms ease-out;
    overflow-y: auto;
    box-shadow: -8px 0 32px var(--shadow-3d);
}

#detail-overlay.active {
    transform: translateX(0);
}

.overlay-leaf-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.05;
    background-image:
        radial-gradient(ellipse 30px 14px at 20% 15%, var(--leaf-organic) 50%, transparent 50%),
        radial-gradient(ellipse 25px 12px at 70% 30%, var(--primary-green) 50%, transparent 50%),
        radial-gradient(ellipse 20px 10px at 40% 55%, var(--leaf-organic) 50%, transparent 50%),
        radial-gradient(ellipse 28px 12px at 80% 75%, var(--primary-green) 50%, transparent 50%),
        radial-gradient(ellipse 22px 10px at 15% 85%, var(--leaf-organic) 50%, transparent 50%);
    pointer-events: none;
}

#overlay-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 200ms ease;
    z-index: 10;
    font-family: 'Nunito', sans-serif;
}

#overlay-close:hover {
    background: var(--complementary-coral);
    color: var(--card-surface);
    border-color: var(--complementary-coral);
}

#overlay-content {
    padding: 48px 32px 32px;
    position: relative;
    z-index: 1;
}

.overlay-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    position: relative;
}

.overlay-category {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary-green);
    display: block;
    margin-bottom: 8px;
}

.overlay-name {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.2;
}

.overlay-description {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.overlay-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--card-border);
}

.detail-label {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.detail-value {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

.overlay-related h3 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.related-item {
    padding: 12px 16px;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 200ms ease;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.related-item:hover {
    background: rgba(42, 140, 90, 0.1);
    color: var(--primary-green);
}

.related-item-category {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 8px;
}

/* --- Overlay Icon Styles --- */
.overlay-icon-certificate {
    position: relative;
}

.overlay-icon-certificate .overlay-cert-body {
    width: 52px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-green), var(--leaf-organic));
    border-radius: 8px;
    position: absolute;
    top: 0;
    left: 0;
    box-shadow: 3px 4px 0 rgba(26, 74, 48, 0.3),
                inset 0 -2px 6px rgba(0, 0, 0, 0.1),
                inset 0 2px 6px rgba(255, 255, 255, 0.2);
}

.overlay-icon-certificate .overlay-cert-seal {
    width: 26px;
    height: 26px;
    background: radial-gradient(circle at 40% 40%, var(--complementary-coral), #a04030);
    border-radius: 50%;
    position: absolute;
    bottom: 0;
    right: 0;
    box-shadow: 2px 3px 0 rgba(26, 74, 48, 0.2),
                inset 0 1px 4px rgba(255, 255, 255, 0.3);
}

.overlay-icon-key {
    position: relative;
}

.overlay-icon-key .overlay-key-head {
    width: 28px;
    height: 28px;
    border: 5px solid var(--primary-green);
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    box-shadow: 2px 3px 0 rgba(26, 74, 48, 0.25);
    background: radial-gradient(circle at 40% 40%, rgba(74, 172, 106, 0.3), transparent);
}

.overlay-icon-key .overlay-key-shaft {
    width: 32px;
    height: 8px;
    background: linear-gradient(180deg, var(--leaf-organic), var(--primary-green));
    border-radius: 4px;
    position: absolute;
    top: 20px;
    left: 22px;
    box-shadow: 2px 2px 0 rgba(26, 74, 48, 0.2);
}

.overlay-icon-key .overlay-key-teeth {
    position: absolute;
    top: 28px;
    left: 42px;
    width: 10px;
    height: 14px;
    background: var(--primary-green);
    border-radius: 0 0 3px 3px;
    box-shadow: 1px 2px 0 rgba(26, 74, 48, 0.2);
}

.overlay-icon-shield {
    position: relative;
}

.overlay-icon-shield .overlay-shield-body {
    width: 46px;
    height: 54px;
    background: linear-gradient(150deg, var(--primary-green), var(--deep-forest));
    clip-path: polygon(50% 0%, 100% 15%, 100% 65%, 50% 100%, 0% 65%, 0% 15%);
    position: absolute;
    top: 2px;
    left: 6px;
}

.overlay-icon-shield .overlay-shield-body::after {
    content: '';
    position: absolute;
    inset: 5px;
    background: linear-gradient(150deg, var(--leaf-organic), var(--primary-green));
    clip-path: polygon(50% 0%, 100% 15%, 100% 65%, 50% 100%, 0% 65%, 0% 15%);
}

.overlay-icon-shield .overlay-shield-check {
    position: absolute;
    top: 18px;
    left: 18px;
    width: 20px;
    height: 12px;
    border-left: 4px solid var(--card-surface);
    border-bottom: 4px solid var(--card-surface);
    transform: rotate(-45deg);
    z-index: 1;
}

/* --- Footer Strip --- */
#footer-strip {
    position: fixed;
    bottom: 0;
    left: var(--panel-width);
    right: 0;
    height: var(--footer-height);
    background: var(--card-surface);
    border-top: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

#footer-count {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

.footer-separator {
    color: var(--card-border);
    font-size: 14px;
}

#footer-filter-label {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.footer-right {
    display: flex;
    align-items: center;
}

#search-input {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 14px;
    padding: 8px 16px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-primary);
    width: 240px;
    outline: none;
    transition: border-color 200ms ease;
}

#search-input::placeholder {
    color: var(--text-secondary);
}

#search-input:focus {
    border-color: var(--primary-green);
}

/* --- Spring Card Entrance Animation --- */
@keyframes cardSpringIn {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    70% {
        opacity: 1;
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.licensor-card.spring-in {
    animation: cardSpringIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* --- Card hidden by filter/search --- */
.licensor-card.hidden {
    display: none;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --panel-width: 0px;
        --footer-height: 60px;
    }

    #left-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        max-height: 60px;
        z-index: 150;
        flex-direction: row;
        overflow: hidden;
        transition: max-height 300ms ease;
    }

    #left-panel.expanded {
        max-height: 100vh;
    }

    .panel-content {
        padding: 12px 16px;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .directory-title {
        font-size: 18px;
        margin-bottom: 0;
    }

    .directory-title br {
        display: none;
    }

    .leaf-cluster {
        display: none;
    }

    .category-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        display: none;
    }

    #left-panel.expanded .category-nav {
        display: flex;
    }

    #gallery-container {
        top: 60px;
        left: 0;
    }

    #footer-strip {
        left: 0;
    }

    .licensor-card {
        flex: 0 0 260px;
        width: 260px;
        height: 380px;
    }

    #detail-overlay {
        width: 100%;
    }

    #search-input {
        width: 160px;
    }
}
