/* Custom Styles for Igvir Ramirez Portfolio */

/* Dark Mode Variables */
:root {
    --bg-color: #fff;
    --text-color: #888;
    --heading-color: #777;
    --link-color: #4acaa8;
    --border-color: #e4e4e4;
    --code-bg: #555;
    --header-bg: #4acaa8;
    --lang-switcher-bg: rgba(255, 255, 255, 0.95);
    --lang-switcher-text: #333;
    --lang-switcher-border: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #b8b8b8;
    --heading-color: #d0d0d0;
    --link-color: #5fd4b0;
    --border-color: #333;
    --code-bg: #2a2a2a;
    --header-bg: #222;
    --lang-switcher-bg: rgba(34, 34, 34, 0.95);
    --lang-switcher-text: #d0d0d0;
    --lang-switcher-border: rgba(255, 255, 255, 0.1);
}

/* Dark Mode Toggle Button */
.theme-toggle {
    position: fixed;
    top: 1em;
    left: 1em;
    z-index: 10000;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    padding: 0.5em;
    border-radius: 50%;
    cursor: pointer;
    width: 2.5em;
    height: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    transform: scale(1.1);
    border-color: var(--link-color);
}

.theme-toggle:focus {
    outline: 3px solid var(--link-color);
    outline-offset: 2px;
}

.theme-toggle svg {
    width: 1.2em;
    height: 1.2em;
    fill: var(--heading-color);
}

/* Language Switcher */
.language-switcher {
    position: fixed;
    top: 1em;
    right: 1em;
    z-index: 10000;
    background: var(--lang-switcher-bg);
    padding: 0.5em 1em;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid var(--lang-switcher-border);
}

.lang-link {
    color: var(--lang-switcher-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: color 0.3s ease;
    padding: 0.3em 0.5em;
}

.lang-link:hover {
    color: var(--link-color);
}

.lang-link.active {
    color: var(--link-color);
    border-bottom: 2px solid var(--link-color);
}

.lang-separator {
    color: var(--border-color);
    margin: 0 0.3em;
}

/* Responsive language switcher */
@media screen and (max-width: 1280px) {
    .language-switcher {
        top: 0.5em;
        right: 0.5em;
        padding: 0.4em 0.8em;
    }
}

@media screen and (max-width: 736px) {
    .language-switcher {
        top: 0.3em;
        right: 0.3em;
        padding: 0.3em 0.6em;
    }
    
    .lang-link {
        font-size: 0.8em;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-color: #1a1a1a;
        --text-color: #b8b8b8;
        --heading-color: #d0d0d0;
        --link-color: #5fd4b0;
        --border-color: #333;
        --code-bg: #2a2a2a;
        --header-bg: #222;
    }
}

/* Apply dark mode colors */
body {
    background: var(--bg-color);
    color: var(--text-color);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
}

a:hover {
    color: var(--link-color) !important;
}

#header {
    background: var(--header-bg);
}

blockquote {
    border-left-color: var(--border-color);
}

code {
    background: var(--code-bg);
}

/* Timeline Styles for Experience Section */
.timeline {
    position: relative;
    padding: 2em 0;
}

.timeline article {
    margin-bottom: 2.5em;
    padding-left: 2em;
    border-left: 3px solid #49bf9d;
    position: relative;
}

.timeline article::before {
    content: '';
    position: absolute;
    left: -0.6em;
    top: 0;
    width: 1em;
    height: 1em;
    background: #49bf9d;
    border-radius: 50%;
    border: 3px solid #fff;
}

.timeline article h4 {
    margin-bottom: 0.5em;
    color: #49bf9d;
}

.timeline article p strong {
    color: #333;
}

.timeline article ul {
    list-style: disc;
    margin-left: 1.5em;
    margin-top: 1em;
}

.timeline article ul li {
    margin-bottom: 0.5em;
}

/* Improved Image Loading */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Accessibility: Skip to main content */
.skip-to-main {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 1em;
    background-color: #49bf9d;
    color: white;
    text-decoration: none;
}

.skip-to-main:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 1em;
}

/* Performance: Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Improved focus states for accessibility */
a:focus,
button:focus {
    outline: 3px solid #49bf9d;
    outline-offset: 2px;
}

/* Better print styles */
@media print {
    .icons,
    nav,
    #header footer {
        display: none;
    }
    
    body {
        font-size: 12pt;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* Responsive improvements */
@media screen and (max-width: 768px) {
    .timeline article {
        padding-left: 1em;
    }
    
    .timeline article::before {
        left: -0.5em;
        width: 0.8em;
        height: 0.8em;
    }
}

/* Loading animation for images */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.image.loading {
    background: linear-gradient(to right, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* LinkedIn Widget Styles */
.linkedin-profile-badge {
    margin: 2em 0;
    padding: 2em;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.linkedin-profile-badge .LI-profile-badge {
    max-width: 100%;
}

/* LinkedIn Posts Info Section */
.linkedin-posts-info {
    margin: 3em 0;
    padding: 2em;
    background: rgba(73, 191, 157, 0.05);
    border-left: 4px solid #49bf9d;
    border-radius: 4px;
}

.linkedin-posts-info h4 {
    color: #49bf9d;
    margin-bottom: 1em;
}

.linkedin-posts-info ol {
    margin: 1em 0;
    padding-left: 1.5em;
}

.linkedin-posts-info ol li {
    margin-bottom: 0.5em;
    line-height: 1.6em;
}

.linkedin-posts-info a {
    color: #49bf9d;
    font-weight: 600;
}

/* LinkedIn Posts Grid */
.linkedin-posts-grid {
    margin: 2em 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2em;
}

.linkedin-post-embed {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.linkedin-post-embed iframe {
    width: 100%;
    max-width: 100%;
    display: block;
}

/* Fix for header overflow */
#header {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

#header > header,
#header > nav,
#header > footer {
    flex-shrink: 0 !important;
}

/* Maintain avatar size */
#header > header .avatar {
    width: 8em !important;
    height: 8em !important;
    margin: 0 auto 2.25em auto !important;
    border-radius: 50% !important;
    overflow: hidden !important;
}

#header > header .avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
}

/* LinkedIn Post Link Card */
.linkedin-post-link {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.linkedin-post-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #0077b5;
    transition: width 0.3s ease;
}

.linkedin-post-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.linkedin-post-link:hover::before {
    width: 8px;
}

.linkedin-post-link a {
    display: flex;
    align-items: center;
    gap: 1em;
    text-decoration: none;
    color: var(--heading-color);
    font-size: 1.2em;
    font-weight: 600;
    border: none;
}

.linkedin-post-link a::before {
    content: '📄';
    font-size: 2em;
    flex-shrink: 0;
}

.linkedin-post-link a:hover {
    color: #0077b5 !important;
}

.linkedin-posts-placeholder {
    text-align: center;
    padding: 3em 2em;
    background: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    grid-column: 1 / -1;
}

.linkedin-posts-placeholder em {
    display: block;
    margin-bottom: 1.5em;
    color: var(--text-color);
    font-size: 1.1em;
}

.linkedin-posts-placeholder .button {
    display: inline-block;
    margin-top: 1em;
}

/* Dark mode support for LinkedIn widget container */
[data-theme="dark"] .linkedin-profile-badge {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

[data-theme="dark"] .linkedin-posts-info {
    background: rgba(73, 191, 157, 0.1);
}

[data-theme="dark"] .linkedin-post-link {
    background: rgba(255, 255, 255, 0.05);
}

/* Responsive adjustments for LinkedIn widget */
@media screen and (max-width: 768px) {
    .linkedin-profile-badge {
        padding: 1em;
        min-height: 250px;
    }
    
    .linkedin-posts-info {
        padding: 1.5em;
    }
    
    .linkedin-posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5em;
    }
    
    .linkedin-post-link a {
        font-size: 1em;
    }
}

@media screen and (max-width: 480px) {
    .linkedin-profile-badge {
        padding: 0.5em;
        min-height: 200px;
    }
    
    .linkedin-posts-info {
        padding: 1em;
    }
    
    .linkedin-posts-placeholder {
        padding: 2em 1em;
    }
    
    .linkedin-post-link {
        padding: 1.5em;
    }
    
    .linkedin-post-link a::before {
        font-size: 1.5em;
    }
}

/* Blog RSS Widget Styles */
.blog-posts-grid {
    margin: 2em 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2em;
}

.blog-post-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    overflow: hidden;
}

.blog-post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.blog-post-content {
    padding: 2em;
}

.blog-post-date {
    display: inline-block;
    font-size: 0.85em;
    color: #49bf9d;
    background: rgba(73, 191, 157, 0.1);
    padding: 0.3em 0.8em;
    border-radius: 4px;
    margin-bottom: 1em;
    font-weight: 600;
}

.blog-post-card h4 {
    margin: 0.5em 0 1em 0;
    font-size: 1.3em;
    line-height: 1.4em;
}

.blog-post-card h4 a {
    color: var(--heading-color);
    text-decoration: none;
    border: none;
    transition: color 0.3s ease;
}

.blog-post-card h4 a:hover {
    color: #49bf9d !important;
}

.blog-post-card p {
    color: var(--text-color);
    line-height: 1.6em;
    margin-bottom: 1.5em;
}

.blog-post-card .read-more {
    display: inline-block;
    color: #49bf9d;
    font-weight: 600;
    text-decoration: none;
    border: none;
    transition: all 0.3s ease;
}

.blog-post-card .read-more:hover {
    color: #3da889 !important;
    transform: translateX(4px);
}

/* Dark mode support for blog cards */
[data-theme="dark"] .blog-post-card {
    background: rgba(255, 255, 255, 0.05);
}

/* Responsive adjustments for blog cards */
@media screen and (max-width: 768px) {
    .blog-posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5em;
    }
    
    .blog-post-content {
        padding: 1.5em;
    }
    
    .blog-post-card h4 {
        font-size: 1.1em;
    }
}

@media screen and (max-width: 480px) {
    .blog-post-content {
        padding: 1em;
    }
    
    .blog-post-card h4 {
        font-size: 1em;
    }
}

/* Contact Form Styles */
#contact-form {
    margin: 2em 0;
}

#contact-form input[type="text"],
#contact-form input[type="email"],
#contact-form textarea {
    width: 100%;
    padding: 0.75em;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1em;
    transition: all 0.3s ease;
}

#contact-form input[type="text"]:focus,
#contact-form input[type="email"]:focus,
#contact-form textarea:focus {
    outline: none;
    border-color: #49bf9d;
    box-shadow: 0 0 0 3px rgba(73, 191, 157, 0.1);
}

#contact-form textarea {
    resize: vertical;
    min-height: 150px;
}

#contact-form .row {
    margin-bottom: 1em;
}

#contact-form .actions {
    display: flex;
    gap: 1em;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

#contact-form .actions li {
    margin: 0;
    padding: 0;
}

#contact-form input[type="submit"],
#contact-form input[type="reset"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85em 2.5em;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    vertical-align: middle;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-height: 44px;
}

#contact-form input[type="submit"] {
    background: #49bf9d;
    color: #ffffff;
    border: 2px solid #49bf9d;
}

#contact-form input[type="submit"]:hover {
    background: #3da889;
    border-color: #3da889;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(73, 191, 157, 0.3);
}

#contact-form input[type="submit"]:active {
    transform: translateY(0);
}

#contact-form input[type="submit"]:disabled {
    background: #ccc;
    border-color: #ccc;
    color: #666;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

#contact-form input[type="reset"] {
    background: #e8e8e8;
    color: #333333;
    border: 2px solid #999999;
}

#contact-form input[type="reset"]:hover {
    background: #d0d0d0;
    border-color: #666666;
    color: #000000;
    transform: translateY(-2px);
}

#contact-form input[type="reset"]:active {
    transform: translateY(0);
}

#form-status {
    padding: 1em;
    border-radius: 4px;
    margin-top: 1em;
}

#form-status a {
    color: inherit;
    text-decoration: underline;
}

/* reCAPTCHA notice */
.recaptcha-notice {
    font-size: 0.85em;
    color: var(--text-color);
    opacity: 0.8;
    margin-top: 1em;
    line-height: 1.5em;
}

.recaptcha-notice a {
    color: #49bf9d;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.recaptcha-notice a:hover {
    border-bottom-color: #49bf9d;
}

/* Hide reCAPTCHA badge (we show our own notice) */
.grecaptcha-badge {
    visibility: hidden;
}

/* Dark mode support for form */
[data-theme="dark"] #contact-form input[type="text"],
[data-theme="dark"] #contact-form input[type="email"],
[data-theme="dark"] #contact-form textarea {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: #e0e0e0;
}

[data-theme="dark"] #contact-form input[type="text"]::placeholder,
[data-theme="dark"] #contact-form input[type="email"]::placeholder,
[data-theme="dark"] #contact-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] #contact-form input[type="submit"] {
    background: #49bf9d;
    color: #ffffff;
    border-color: #49bf9d;
}

[data-theme="dark"] #contact-form input[type="submit"]:hover {
    background: #5fd4b0;
    border-color: #5fd4b0;
}

[data-theme="dark"] #contact-form input[type="submit"]:disabled {
    background: #444;
    border-color: #444;
    color: #888;
}

[data-theme="dark"] #contact-form input[type="reset"] {
    background: #2a2a2a;
    color: #ffffff;
    border-color: #555555;
}

[data-theme="dark"] #contact-form input[type="reset"]:hover {
    background: #3a3a3a;
    border-color: #777777;
    color: #ffffff;
}

/* Responsive form adjustments */
@media screen and (max-width: 768px) {
    #contact-form .actions {
        flex-direction: column;
        width: 100%;
    }
    
    #contact-form .actions li {
        width: 100%;
    }
    
    #contact-form input[type="submit"],
    #contact-form input[type="reset"] {
        width: 100%;
        margin-bottom: 0.5em;
    }
}
