/* =====================================================
   POLICIES HUB - Company Policy Directory
   Extracted from inline styles + new improvements
   ===================================================== */

/* =====================================================
   LAYOUT - Main Container with TOC Sidebar
   ===================================================== */
.policies-page-wrapper {
    display: flex;
    gap: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

.policies-container {
    flex: 1;
    min-width: 0;
}

/* =====================================================
   TABLE OF CONTENTS SIDEBAR
   ===================================================== */
.toc-sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.toc-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.toc-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.toc-category {
    margin-bottom: 1rem;
}

.toc-category-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--wsu-crimson);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-category-title i {
    font-size: 0.75rem;
    opacity: 0.8;
}

.toc-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-link {
    display: block;
    padding: 0.375rem 0.75rem;
    margin-left: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.toc-link:hover {
    color: var(--wsu-crimson);
    border-left-color: var(--wsu-crimson);
    background: var(--light-bg);
}

/* =====================================================
   HEADER
   ===================================================== */
.hub-header {
    background: linear-gradient(135deg, var(--wsu-crimson) 0%, var(--wsu-grey) 100%);
    color: white;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.hub-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.hub-header h1 i {
    margin-right: 0.5rem;
}

.hub-header p {
    font-size: 1rem;
    opacity: 0.95;
}

/* =====================================================
   SEARCH & VIEW CONTROLS
   ===================================================== */
.search-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.search-wrapper {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--wsu-crimson);
    box-shadow: 0 0 0 3px rgba(152, 30, 50, 0.1);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* View Toggle Buttons */
.view-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--light-bg);
    padding: 0.25rem;
    border-radius: 6px;
}

.view-toggle-btn {
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    color: var(--wsu-crimson);
}

.view-toggle-btn.active {
    background: white;
    color: var(--wsu-crimson);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* =====================================================
   CATEGORY FILTERS - Enhanced with Icons & Counts
   ===================================================== */
.policy-categories {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.category-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.category-filter i {
    font-size: 0.875rem;
    opacity: 0.7;
}

.category-filter .count {
    background: var(--light-bg);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    min-width: 1.5rem;
    text-align: center;
}

.category-filter:hover {
    background: var(--light-bg);
    border-color: var(--wsu-crimson);
}

.category-filter:hover i {
    opacity: 1;
}

.category-filter.active {
    background: var(--wsu-crimson);
    color: white;
    border-color: var(--wsu-crimson);
}

.category-filter.active i {
    opacity: 1;
}

.category-filter.active .count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* =====================================================
   RECENTLY UPDATED SECTION
   ===================================================== */
.recently-updated {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.recently-updated-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #166534;
    margin-bottom: 0.75rem;
}

.recently-updated-header i {
    color: #22c55e;
}

.recent-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.recent-item:hover {
    background: #f0fdf4;
    transform: translateX(4px);
}

.recent-item .new-badge {
    background: #22c55e;
    color: white;
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.recent-item-title {
    flex: 1;
    font-weight: 500;
}

.recent-item-date {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

/* =====================================================
   POLICIES GRID VIEW (Cards)
   ===================================================== */
.policies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.policy-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    border-left: 4px solid var(--wsu-crimson);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.policy-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.policy-card.new-policy::before {
    content: 'NEW';
    position: absolute;
    top: -8px;
    right: 1rem;
    background: #22c55e;
    color: white;
    font-size: 0.625rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
}

.policy-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--light-bg);
    color: var(--wsu-grey);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.policy-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

/* Truncated descriptions with line-clamp */
.policy-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.policy-description-full {
    display: none;
}

.policy-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.policy-updated,
.policy-owner {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* =====================================================
   POLICIES LIST VIEW
   ===================================================== */
.policies-list {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.policies-list.active {
    display: flex;
}

.policies-grid.hidden {
    display: none;
}

.policy-list-header {
    display: grid;
    grid-template-columns: 1fr 120px 100px 100px;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--light-bg);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.policy-list-item {
    display: grid;
    grid-template-columns: 1fr 120px 100px 100px;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    align-items: center;
}

.policy-list-item:hover {
    background: var(--light-bg);
    transform: translateX(4px);
}

.policy-list-title {
    font-weight: 500;
    color: var(--text-primary);
}

.policy-list-title .new-badge {
    background: #22c55e;
    color: white;
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.policy-list-category {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.policy-list-date,
.policy-list-owner {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* =====================================================
   QUICK ACTIONS (moved below main content)
   ===================================================== */
.quick-actions {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.quick-actions-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.quick-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.quick-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.quick-link:hover {
    background: var(--wsu-crimson);
    color: white;
    border-color: var(--wsu-crimson);
    transform: translateY(-1px);
}

/* =====================================================
   BACK TO DASHBOARD BUTTON
   ===================================================== */
.back-to-dashboard {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.75rem 1.25rem;
    background: var(--wsu-crimson);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(152, 30, 50, 0.3);
    transition: all 0.2s ease;
    z-index: 100;
}

.back-to-dashboard:hover {
    background: var(--wsu-dark-crimson);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(152, 30, 50, 0.4);
}

/* =====================================================
   MOBILE RESPONSIVENESS
   ===================================================== */
@media (max-width: 1024px) {
    .policies-page-wrapper {
        flex-direction: column;
    }

    .toc-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .policies-page-wrapper {
        padding: 1rem;
    }

    .hub-header {
        padding: 1.5rem;
    }

    .hub-header h1 {
        font-size: 1.5rem;
    }

    .search-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .view-toggle {
        justify-content: center;
    }

    .policies-grid {
        grid-template-columns: 1fr;
    }

    .policy-list-header,
    .policy-list-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .policy-list-header > *:not(:first-child) {
        display: none;
    }

    .policy-list-item > *:not(:first-child) {
        display: none;
    }

    .back-to-dashboard {
        bottom: 1rem;
        right: 1rem;
    }
}
