/* Custom styles for Altegon Documentation */

/* Logo visibility fix for red header */
.md-header__button img,
.md-logo img,
.md-logo svg {
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-height: 32px;
    width: auto;
}

/* Header title styling */
.md-header__title {
    font-weight: 600;
}

/* Ensure logo has proper opacity */
.md-logo {
    opacity: 1;
}

/* Custom color scheme with Altegon red */
:root {
    --md-primary-fg-color: #ed1c24;
    --md-primary-fg-color--light: #f44336;
    --md-primary-fg-color--dark: #c62828;
    --md-accent-fg-color: #ed1c24;
    --altegon-red: #ed1c24;
    --altegon-red-light: #ff5252;
    --altegon-red-dark: #d32f2f;
}

/* Custom red theme overrides */
[data-md-color-primary="red"] {
    --md-primary-fg-color: #ed1c24;
    --md-primary-fg-color--light: #f44336;
    --md-primary-fg-color--dark: #c62828;
}

/* Header customization */
.md-header {
    background-color: var(--altegon-red);
}

/* Navigation tabs */
.md-tabs {
    background-color: var(--altegon-red-dark);
}

/* Active navigation elements */
.md-nav__link--active,
.md-nav__link:hover {
    color: var(--altegon-red);
}

/* Buttons and links */
.md-button {
    background-color: var(--altegon-red);
    border-color: var(--altegon-red);
}

.md-button:hover {
    background-color: var(--altegon-red-dark);
    border-color: var(--altegon-red-dark);
}

/* Search highlighting */
.md-search-result__meta {
    color: var(--altegon-red);
}

/* Code blocks with red accent */
.highlight {
    border-radius: 8px;
    overflow: hidden;
    border-left: 4px solid var(--altegon-red);
}

/* Custom admonition styles with red theme */
.md-typeset .admonition.tip {
    border-color: var(--altegon-red);
}

.md-typeset .admonition.tip > .admonition-title {
    background-color: rgba(237, 28, 36, 0.1);
    border-color: var(--altegon-red);
}

.md-typeset .admonition.info {
    border-color: var(--altegon-red);
}

.md-typeset .admonition.info > .admonition-title {
    background-color: rgba(237, 28, 36, 0.1);
    border-color: var(--altegon-red);
}

/* Grid cards styling */
.grid.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.grid.cards > .card {
    border: 1px solid var(--md-default-fg-color--lighter);
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.2s ease-in-out;
}

.grid.cards > .card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* API method badges with red theme */
.api-method {
    display: inline-block;
    padding: 0.2em 0.6em;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
    margin-right: 0.5em;
}

.api-method.get { background-color: #4caf50; }
.api-method.post { background-color: var(--altegon-red); }
.api-method.put { background-color: #ff9800; }
.api-method.delete { background-color: var(--altegon-red-dark); }

/* Status indicators with red theme */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5em;
}

.status-online { background-color: #4caf50; }
.status-offline { background-color: var(--altegon-red); }
.status-warning { background-color: #ff9800; }

/* Feature comparison tables */
.feature-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.feature-table th,
.feature-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--md-default-fg-color--lighter);
}

.feature-table th {
    background-color: var(--altegon-red);
    color: white;
    font-weight: 600;
}

.feature-table tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Code syntax highlighting improvements */
.highlight .err { 
    border: none; 
    background-color: transparent; 
}

/* Custom button styles with red theme */
.custom-button {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--altegon-red);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease-in-out;
}

.custom-button:hover {
    background-color: var(--altegon-red-dark);
    color: white;
}

/* Responsive video containers */
.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    border-radius: 8px;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Architecture diagram styling */
.mermaid {
    text-align: center;
    margin: 2rem 0;
}

/* Zoomable architecture diagrams */
.architecture-diagram {
    text-align: center;
    margin: 2rem 0;
}

.architecture-diagram img {
    max-width: 100%;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    display: block;
    margin: 0 auto;
}

.architecture-diagram img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Also style any image with architecture in alt text or zoom in title */
img[alt*="Architecture"],
img[title*="zoom"] {
    max-width: 100%;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: zoom-in !important;
    display: block;
    margin: 1rem auto;
}

img[alt*="Architecture"]:hover,
img[title*="zoom"]:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Modal overlay for zoomed images */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    cursor: zoom-out;
    overflow: auto;
    padding: 20px;
    box-sizing: border-box;
}

.image-modal img {
    display: block;
    margin: 20px auto;
    width: auto;
    height: auto;
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    position: relative;
    top: auto;
    left: auto;
    transform: none;
}

.image-modal .close {
    position: fixed;
    top: 30px;
    right: 40px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1002;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.image-modal .close:hover {
    opacity: 0.7;
}

/* Dark mode adjustments for zoomable images */
[data-md-color-scheme="slate"] .architecture-diagram img {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

[data-md-color-scheme="slate"] .architecture-diagram img:hover {
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.15);
}

/* Progress indicators with red theme */
.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background-color: var(--altegon-red);
    transition: width 0.3s ease-in-out;
}

/* Additional red theme customizations */

/* Footer links */
.md-footer-meta__inner a {
    color: var(--altegon-red);
}

.md-footer-meta__inner a:hover {
    color: var(--altegon-red-dark);
}

/* Social links */
.md-social__link {
    color: var(--altegon-red);
}

.md-social__link:hover {
    color: var(--altegon-red-dark);
}

/* Table of contents active items */
.md-nav__link--active {
    color: var(--altegon-red) !important;
}

/* Scroll indicator */
.md-nav__link--passed {
    color: var(--altegon-red);
}

/* Link colors */
.md-content a {
    color: var(--altegon-red);
}

.md-content a:hover {
    color: var(--altegon-red-dark);
}

/* Version selector */
.md-version__current {
    color: var(--altegon-red);
}

/* Search results */
.md-search-result__title {
    color: var(--altegon-red);
}

/* Checkbox styling */
.md-typeset input[type="checkbox"]:checked + label:before {
    background-color: var(--altegon-red);
    border-color: var(--altegon-red);
}

/* Tab styling */
.md-typeset .tabbed-set input:checked + label {
    color: var(--altegon-red);
    border-color: var(--altegon-red);
}

/* Announcement bar */
.md-banner {
    background-color: var(--altegon-red);
}

/* Dark mode adjustments */
[data-md-color-scheme="slate"] .grid.cards > .card {
    border-color: var(--md-default-fg-color--lightest);
    background-color: rgba(255, 255, 255, 0.05);
}

[data-md-color-scheme="slate"] .feature-table tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Dark mode adjustments for red theme */
[data-md-color-scheme="slate"] {
    --altegon-red-light: #ff6b6b;
    --altegon-red-dark: #cc1a1a;
}

[data-md-color-scheme="slate"] .md-header {
    background-color: var(--altegon-red-dark);
}

[data-md-color-scheme="slate"] .md-tabs {
    background-color: rgba(237, 28, 36, 0.2);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .grid.cards {
        grid-template-columns: 1fr;
    }
    
    .feature-table {
        font-size: 0.9em;
    }
    
    .feature-table th,
    .feature-table td {
        padding: 0.5rem;
    }
}

/* Print styles */
@media print {
    .md-header,
    .md-sidebar,
    .md-footer {
        display: none;
    }
    
    .md-content {
        margin: 0;
    }
    
    .image-modal {
        display: none !important;
    }
}

/* ======= Auth Popup ======= */
#auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.auth-modal {
  background: #fff;
  padding: 2rem;
  border-radius: 10px;
  max-width: 320px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 20px rgba(0,0,0,0.2);
  animation: fadeIn 0.3s ease;
}

.auth-modal h2 {
  margin-bottom: 0.5rem;
}

.auth-modal input {
  padding: 0.5rem;
  font-size: 1.2rem;
  width: 80%;
  text-align: center;
  margin-bottom: 1rem;
}

.auth-modal button {
  background: #d32f2f;
  color: white;
  border: none;
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  border-radius: 5px;
  font-size: 1rem;
}

.auth-modal button:hover {
  background: #b71c1c;
}

.error-text {
  color: #d32f2f;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
