/* Additional CSS for Enhanced Functionality */

/* Back to Top Button Styles */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Header Scroll Effects */
.site-header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .site-header.scrolled {
    background: rgba(26, 26, 26, 0.98);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.site-header.hidden {
    transform: translateY(-100%);
}

/* Form Enhancements */
.form-group.has-error input,
.form-group.has-error textarea {
    border-color: #ff4757;
    box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.1);
}

.error-message {
    color: #ff4757;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    display: block;
}

.form-message {
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    font-weight: 500;
}

.form-message.success {
    background: #2ed573;
    color: white;
}

.form-message.error {
    background: #ff4757;
    color: white;
}

.submit-btn.success {
    background: #2ed573 !important;
    transform: scale(1.05);
}

/* Portfolio Item Enhancements */
.portfolio-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

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

/* Search Form Styles */
.search-form {
    display: flex;
    max-width: 400px;
    margin: 2rem auto;
    gap: 0.5rem;
}

.search-field {
    flex: 1;
    padding: 1rem;
    border: 2px solid var(--card-bg);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
}

.search-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.search-submit {
    padding: 1rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.search-submit:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 3rem 0;
}

.pagination .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    height: 45px;
    background: var(--card-bg);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pagination .page-numbers:hover,
.pagination .page-numbers.current {
    background: var(--gradient-primary);
    color: white;
    transform: translateY(-2px);
}

.pagination .page-numbers.dots {
    background: transparent;
    cursor: default;
}

.pagination .page-numbers.dots:hover {
    transform: none;
}

/* Widget Styles */
.widget {
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 15px;
}

.widget-title {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.widget ul {
    list-style: none;
    padding: 0;
}

.widget ul li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.widget ul li:last-child {
    border-bottom: none;
}

.widget ul li a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.widget ul li a:hover {
    color: var(--primary-color);
}

/* Comments Styles */
.comments-area {
    margin-top: 3rem;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 15px;
}

.comments-title {
    color: var(--text-color);
    margin-bottom: 2rem;
}

.comment-list {
    list-style: none;
    padding: 0;
}

.comment {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.comment-author {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.comment-meta {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 1rem;
}

.comment-content {
    color: var(--text-color);
}

.comment-reply-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.comment-reply-link:hover {
    color: var(--secondary-color);
}

/* Comment Form */
.comment-form {
    margin-top: 2rem;
}

.comment-form-comment textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--card-bg);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

.comment-form-author input,
.comment-form-email input,
.comment-form-url input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--card-bg);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
}

.form-submit input[type="submit"] {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-submit input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.3);
}

/* Mobile Menu Hamburger Animation */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.menu-toggle .hamburger {
    width: 100%;
    height: 3px;
    background: var(--text-color);
    transition: all 0.3s ease;
    transform-origin: center;
}

.menu-toggle[aria-expanded="true"] .hamburger:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle[aria-expanded="true"] .hamburger:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] .hamburger:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Theme Transition */
.theme-transitioning * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.loaded {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 107, 107, 0.2);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Print Styles */
@media print {
    .site-header,
    .site-footer,
    .back-to-top,
    .lightbox,
    .menu-toggle,
    .theme-toggle {
        display: none !important;
    }
    
    .site-main {
        margin: 0;
        padding: 0;
    }
    
    .portfolio-item,
    .portfolio-archive-item {
        break-inside: avoid;
        margin-bottom: 2rem;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0066cc;
        --secondary-color: #cc6600;
        --text-light: #000000;
        --text-dark: #ffffff;
        --bg-light: #ffffff;
        --bg-dark: #000000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .fade-in,
    .slide-in-left,
    .slide-in-right {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Focus Indicators for Accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Screen Reader Only Text */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: #21759b;
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Additional Typography Styles */
blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 2rem;
    margin: 2rem 0;
    font-style: italic;
    font-size: 1.2rem;
    color: var(--text-color);
    opacity: 0.9;
}

code {
    background: var(--card-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--primary-color);
}

pre {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 10px;
    overflow-x: auto;
    margin: 2rem 0;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text-color);
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

td {
    color: var(--text-color);
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Selection Styles */
::selection {
    background: var(--primary-color);
    color: white;
}

::-moz-selection {
    background: var(--primary-color);
    color: white;
}
