/* Variables */
:root {
    --color-primary: #667EEA;
    --color-secondary: #764BA2;
    --color-accent: #48BB78;
    --color-bg-primary: #FFFFFF;
    --color-bg-secondary: #F9FAFB;
    --color-bg-tertiary: #F3F4F6;
    --color-danger: #EF4444;
    --color-text-primary: #1F2937;
    --color-text-secondary: #6B7280;
    --color-text-tertiary: #9CA3AF;
    --color-white: #ffffff;
    
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Helvetica Neue', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 0 0 0.5px rgba(0, 0, 0, 0.04), 0 2px 8px 0 rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 20px 25px -5px rgba(0, 0, 0, 0.15);
    
    --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(72, 187, 120, 0.02) 0%, transparent 50%),
        linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 50%, #E5E7EB 100%);
    background-attachment: fixed;
    line-height: 1.5;
    overflow-x: hidden;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(102, 126, 234, 0.01) 35px, rgba(102, 126, 234, 0.01) 70px);
    pointer-events: none;
    z-index: -1;
}

/* Navbar */
.navbar.bg-gradient {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.04), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.navbar-brand {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary) !important;
    letter-spacing: -0.02em;
}

.navbar-brand img.navbar-logo {
    width: 32px;
    height: 32px;
    margin-right: 0.65rem;
    object-fit: contain;
    vertical-align: middle;
}

.search-container {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-tertiary);
    pointer-events: none;
    font-size: 0.875rem;
}

.search-input {
    padding: 0.5rem 0.75rem 0.5rem 2rem !important;
    border-radius: 8px !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    background: rgba(0, 0, 0, 0.03) !important;
    color: var(--color-text-primary) !important;
    min-width: 220px;
    font-size: 0.875rem;
    transition: all 0.2s var(--ease-smooth);
}

.search-input::placeholder {
    color: var(--color-text-tertiary);
}

.search-input:focus {
    background: white !important;
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

.dropdown-menu {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.15s var(--ease-smooth);
    margin-bottom: 2px;
}

.dropdown-item i {
    width: 18px;
    margin-right: 8px;
    opacity: 0.6;
}

.dropdown-item img.platform-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    object-fit: contain;
    opacity: 0.9;
    border-radius: 3px;
    padding: 1px;
}

.dropdown-item.active img.platform-icon {
    opacity: 1;
}

.dropdown-item.active {
    background: var(--color-primary);
    color: white;
}

.dropdown-item.active i {
    opacity: 1;
}

.dropdown-item:hover:not(.active) {
    background: var(--color-bg-tertiary);
}

.dropdown-item[data-filter="all"]:not(.active) {
    background: var(--color-primary);
    color: white;
    font-weight: 600;
}

.dropdown-item[data-filter="all"]:not(.active) i {
    opacity: 1;
}

.grid-size-btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    background: rgba(0, 0, 0, 0.03) !important;
    color: var(--color-text-secondary) !important;
    transition: all 0.15s var(--ease-smooth);
}

.grid-size-btn.active {
    background: var(--color-text-primary) !important;
    border-color: var(--color-text-primary) !important;
    color: white !important;
}

.grid-size-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.06) !important;
}

.navbar .text-white-50 {
    color: var(--color-text-secondary) !important;
    font-size: 0.875rem;
}

.navbar .text-white-50 strong {
    color: var(--color-text-primary) !important;
    font-weight: 600;
}

/* Certificates Grid */
.certificates-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--spacing-2xl) var(--spacing-lg);
    min-height: calc(100vh - 140px); /* Sticky footer */
}

.certificates-grid {
    display: grid;
    gap: var(--spacing-lg);
    transition: all 0.3s var(--ease-smooth);
}

.certificates-grid.cols-3 {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
}

.certificates-grid.cols-4 {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.certificates-grid.cols-5 {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Certificate Cards */
.certificate-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.3s var(--ease-spring);
    opacity: 0;
    transform: translateY(15px);
    animation: cardFadeIn 0.5s var(--ease-spring) forwards;
    display: flex;
    flex-direction: column;
}

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

.certificate-card:hover {
    transform: translateY(-8px);
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.04),
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(102, 126, 234, 0.1);
}

.card-pdf-preview {
    width: 100%;
    aspect-ratio: 16/11;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.pdf-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    opacity: 0;
    transition: opacity 0.5s var(--ease-smooth), transform 0.6s var(--ease-spring);
}

.pdf-thumbnail.loaded {
    opacity: 1;
}

.certificate-card:hover .pdf-thumbnail.loaded {
    transform: scale(1.04);
}

.thumbnail-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-primary);
    font-size: 1.5rem;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.pdf-placeholder {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    box-shadow: var(--shadow-lg);
}

.card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-bottom: 0;
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.4;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.clickable-title {
    cursor: pointer;
    transition: color 0.2s var(--ease-smooth);
}

.clickable-title:hover {
    color: var(--color-primary);
}

@media (max-width: 767px) {
    .clickable-title {
        cursor: default;
    }
    
    .clickable-title:hover {
        color: var(--color-text-primary);
    }
}

.platform-badge {
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    flex-shrink: 0;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.platform-badge img.badge-logo {
    width: 14px;
    height: 14px;
    object-fit: contain;
    border-radius: 2px;
    padding: 1px;
}

.badge-coursera {
    background: rgba(102, 126, 234, 0.1);
    color: var(--color-primary);
    border-color: rgba(102, 126, 234, 0.2);
}

.badge-udemy {
    background: rgba(118, 75, 162, 0.1);
    color: var(--color-secondary);
    border-color: rgba(118, 75, 162, 0.2);
}

.badge-google {
    background: rgba(72, 187, 120, 0.1);
    color: var(--color-accent);
    border-color: rgba(72, 187, 120, 0.2);
}

.badge-gitiho {
    background: rgba(102, 126, 234, 0.15);
    color: #5568D3;
    border-color: rgba(102, 126, 234, 0.25);
}

.badge-hack {
    background: rgba(107, 114, 128, 0.1);
    color: var(--color-text-secondary);
    border-color: rgba(107, 114, 128, 0.2);
}

.card-footer-content {
    margin-top: auto;
    padding-top: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card-date {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}

.card-date i {
    font-size: 0.875rem;
    opacity: 0.7;
}

.card-links {
    display: flex;
    margin-top: 0;
}

.cert-url-link {
    font-size: 0.8125rem;
    color: var(--color-accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s var(--ease-smooth);
    font-weight: 500;
}

.cert-url-link:hover {
    color: var(--color-primary);
    transform: translateX(2px);
}

.cert-url-link i {
    font-size: 0.75rem;
}

/* PDF Modal */
.pdf-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    animation: modalFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.pdf-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

@keyframes modalFadeIn {
    from { 
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to { 
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

.pdf-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
}

.pdf-modal-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1600px;
    max-height: 95vh;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 0 0 0.5px rgba(0, 0, 0, 0.1),
        0 25px 50px -12px rgba(0, 0, 0, 0.4),
        0 0 80px -20px rgba(102, 126, 234, 0.3);
    z-index: 10000;
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.pdf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1.25rem;
    background: rgba(247, 250, 252, 0.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.pdf-modal-header h5 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    letter-spacing: -0.01em;
}

.pdf-modal-close {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.pdf-modal-close:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.05);
}

.pdf-modal-close:active {
    transform: scale(0.95);
}

.pdf-modal-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    overflow: auto;
    background: #f8fafc;
}

#pdf-canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 2px;
    box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 1rem 1.5rem;
    margin-top: var(--spacing-2xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--color-text-secondary);
    font-size: 0.8125rem;
}

.footer span {
    font-weight: 500;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.github-link,
.website-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.04);
    transition: all 0.2s var(--ease-smooth);
    text-decoration: none;
}

.github-link i,
.website-link i {
    font-size: 1.125rem;
    color: var(--color-text-primary);
}

.github-link:hover {
    background: var(--color-text-primary);
    transform: scale(1.05);
}

.github-link:hover i {
    color: white;
}

.website-link:hover {
    background: var(--color-primary);
    transform: scale(1.05);
}

.website-link:hover i {
    color: white;
}

/* Responsive */
@media (max-width: 1024px) {
    .certificates-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .pdf-modal.active {
        padding: 0;
    }
    
    .pdf-modal-container {
        max-height: 100vh;
        border-radius: 0;
    }
    
    .pdf-modal-body {
        padding: 1rem;
    }
    
    .certificates-grid {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        flex-direction: column;
    }
    
    .footer {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
}
