/* Elegant Brown Color Scheme */
:root {
    --primary-bg: #E6E5E3;
    --secondary-bg: #f8f7f5;
    --accent-brown: #A7A19F;
    --dark-brown: #8B7D7A;
    --light-brown: #D4CFC8;
    --white: #ffffff;
    --text-dark: #3D3530;
    --text-light: #8B7D7A;
    --warm-accent: #B8A082;
    --success-color: #8B9A6B;
    --shadow: 0 12px 35px rgba(61, 53, 48, 0.08);
    --shadow-hover: 0 18px 45px rgba(61, 53, 48, 0.12);
    --border-radius: 16px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.7;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
    min-height: 100vh;
    font-weight: 400;
}

.container {
    display: flex;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--white);
    box-shadow: var(--shadow);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Sidebar Styles */
.sidebar {
    width: 320px;
    background: linear-gradient(135deg, var(--primary-bg) 0%, #f0f0f0 100%);
    padding: 50px 35px;
    display: flex;
    flex-direction: column;
    position: relative;
    border-right: 1px solid rgba(0,0,0,0.05);
}

.profile-section .name {
    font-family: 'Playfair Display', serif;
    font-size: 36px;
    font-weight: 400;
    line-height: 1.1;
    color: var(--text-dark);
    margin-bottom: 50px;
    letter-spacing: -0.8px;
}

.projects-section h2 {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 25px;
    letter-spacing: -0.4px;
}

.projects-description {
    font-size: 15px;
    color: var(--text-light);
    margin-bottom: 35px;
    line-height: 1.7;
}

.skills-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.skill-item {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 15px;
    color: var(--text-light);
    padding: 12px 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 8px;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
}

.skill-item:hover {
    background: rgba(167, 161, 159, 0.15);
    color: var(--warm-accent);
    transform: translateX(8px);
    box-shadow: 0 4px 15px rgba(167, 161, 159, 0.1);
}

.skill-item.active {
    background: var(--accent-brown);
    color: var(--white);
    transform: translateX(8px);
    box-shadow: 0 6px 20px rgba(167, 161, 159, 0.3);
}

.skill-item.active i {
    color: var(--white);
}

.skill-item.loading {
    pointer-events: none;
}

.skill-item.loading i {
    animation: spin 1s linear infinite;
}

.skill-item i {
    width: 22px;
    color: var(--text-light);
    transition: var(--transition);
    font-size: 16px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(0deg); }
}

/* Main Content Styles */
.main-content {
    flex: 1;
    padding: 50px 45px;
    background: var(--white);
    position: relative;
}

.portfolio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
    padding-bottom: 25px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.portfolio-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 48px;
    font-weight: 400;
    color: var(--text-dark);
    letter-spacing: -1.2px;
}



/* Portfolio Grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    min-height: 400px; /* Prevent layout shift during filtering */
}

@media (max-width: 1024px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
}

/* Filter Animation Enhancement */
.portfolio-item {
    will-change: transform, opacity;
}

.portfolio-item:nth-child(even) {
    animation-delay: 0.1s;
}

.portfolio-item:nth-child(odd) {
    animation-delay: 0.05s;
}

.portfolio-item {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid rgba(61, 53, 48, 0.05);
}

.portfolio-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.portfolio-image {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-bg), #f0f0f0);
}

.portfolio-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.portfolio-item:hover .portfolio-image img {
    transform: scale(1.08);
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(61, 53, 48, 0.85);
    color: var(--white);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.portfolio-item:hover .play-button {
    background: rgba(167, 161, 159, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

.portfolio-content {
    padding: 25px;
}

.category {
    display: inline-block;
    background: var(--primary-bg);
    color: var(--text-dark);
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 15px;
    margin-bottom: 15px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.portfolio-content h3 {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 10px;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.portfolio-content p {
    font-size: 15px;
    color: var(--text-light);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 3em;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

.close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.project-form {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    height: 80px;
    resize: vertical;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

.btn-cancel,
.btn-submit {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-cancel {
    background: #95a5a6;
    color: white;
}

.btn-cancel:hover {
    background: #7f8c8d;
}

.btn-submit {
    background: #3498db;
    color: white;
}

.btn-submit:hover {
    background: #2980b9;
}

/* Project Detail Modal */
.project-detail-modal {
    max-width: 700px;
}

.project-detail-content {
    padding: 30px;
    display: flex;
    gap: 30px;
}

.project-detail-image {
    flex: 1;
}

.project-detail-image img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 8px;
}

.project-detail-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.project-detail-info h3 {
    font-size: 20px;
    color: #2c3e50;
    margin: 0;
}

.project-detail-info p {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

.btn-view-project {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #3498db;
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.3s;
    align-self: flex-start;
}

.btn-view-project:hover {
    background: #2980b9;
}

/* Portfolio item filtering */
.portfolio-item.hidden {
    display: none;
}

.portfolio-item.fade-out {
    opacity: 0;
    transform: scale(0.8);
}

.portfolio-item.fade-in {
    opacity: 1;
    transform: scale(1);
}

/* Responsive for project detail modal */
@media (max-width: 768px) {
    .project-detail-content {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }

    .project-detail-image img {
        height: 200px;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        padding: 20px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .portfolio-header {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
}

/* Print Styles */
@media print {

    .container {
        box-shadow: none;
        max-width: none;
        margin: 0;
        display: block;
    }

    .sidebar {
        background: white;
        width: 100%;
        padding: 20px;
        page-break-after: avoid;
    }

    .main-content {
        padding: 20px;
    }

    .portfolio-item {
        break-inside: avoid;
        margin-bottom: 15px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .portfolio-image {
        height: 150px;
    }

    .portfolio-content {
        padding: 15px;
    }

    .portfolio-header h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .name {
        font-size: 24px !important;
    }

    .projects-description {
        font-size: 12px;
    }

    .skill-item {
        font-size: 12px;
    }

    /* Ensure good contrast for print */
    .category {
        background: #e8e8e8;
        color: #333;
    }

    /* Page breaks */
    .sidebar {
        page-break-after: avoid;
    }

    .portfolio-header {
        page-break-after: avoid;
    }
}

/* Additional utility classes */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

/* Loading animation for images */
.portfolio-image img {
    transition: opacity 0.3s;
}

.portfolio-image img[src=""] {
    opacity: 0;
}

/* Better focus states for accessibility */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--primary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dark);
}

/* Project Detail Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(61, 53, 48, 0.8);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 30px 30px 20px;
    border-bottom: 1px solid rgba(61, 53, 48, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 500;
    color: var(--text-dark);
    letter-spacing: -0.3px;
}

.close-project {
    width: 40px;
    height: 40px;
    background: var(--primary-bg);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-light);
    font-size: 18px;
    font-weight: bold;
}

.close-project:hover {
    background: var(--accent-brown);
    color: var(--white);
    transform: scale(1.1);
}

.project-detail-content {
    padding: 30px;
    display: flex;
    gap: 30px;
    min-height: 0; /* Allow flex container to shrink */
    overflow: hidden; /* Prevent content overflow */
}

.project-detail-image {
    flex: 1;
}

.project-detail-image img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(61, 53, 48, 0.15);
}

.project-detail-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0; /* Allow flex item to shrink */
    overflow: hidden; /* Prevent overflow from container */
}

.project-detail-info .category {
    align-self: flex-start;
}

.project-detail-info h3 {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 500;
    color: var(--text-dark);
    margin: 0;
    letter-spacing: -0.4px;
    line-height: 1.2;
}

.project-detail-info p {
    color: var(--text-light);
    line-height: 1.7;
    margin: 0;
    font-size: 16px;
    /* Normal text wrapping in modal */
    display: block;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    hyphens: auto;
}

.btn-view-project {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--accent-brown), var(--dark-brown));
    color: var(--white);
    text-decoration: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 15px;
    transition: var(--transition);
    align-self: flex-start;
    box-shadow: 0 4px 15px rgba(167, 161, 159, 0.25);
}

.btn-view-project:hover {
    background: linear-gradient(135deg, var(--dark-brown), #6B5F5C);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(167, 161, 159, 0.35);
}

/* Gallery Styles */
.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.gallery-item {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(61, 53, 48, 0.1);
    border: 2px solid transparent;
}

.gallery-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 35px rgba(61, 53, 48, 0.25);
    border-color: var(--accent-color);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(167, 161, 159, 0.9), rgba(61, 53, 48, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    backdrop-filter: blur(2px);
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay i {
    color: var(--white);
    font-size: 28px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    transition: var(--transition);
}

.gallery-item:hover .gallery-overlay i {
    transform: scale(1);
}

/* Gallery Modal */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.gallery-modal.active {
    display: flex;
}

.gallery-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
}

.gallery-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.gallery-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.gallery-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.gallery-prev {
    left: 20px;
}

.gallery-next {
    right: 20px;
}

/* Responsive for project detail modal */
@media (max-width: 768px) {
    .project-detail-content {
        flex-direction: column;
        gap: 25px;
        padding: 25px;
    }

    .project-detail-image img {
        height: 220px;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }
}
