/**
 * HTML from Git Plugin Stylesheet
 * Version: 1.0.0
 * 
 * Provides default styling for HTML content fetched from Git repositories,
 * including checkout information, commit history, and error messages.
 */

/* ==========================================================================
   Main HTML Content Wrapper
   ========================================================================== */

/**
 * Main wrapper for HTML content fetched from Git repositories
 * Applied to all content displayed via git-{provider}-html shortcodes
 */
.html-from-git {
    margin: 20px 0;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    line-height: 1.6;
    color: #333;
}

/* Ensure nested content has proper spacing */
.html-from-git > *:first-child {
    margin-top: 0;
}

.html-from-git > *:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Checkout Information Styling
   ========================================================================== */

/**
 * Wrapper for checkout information (source link and last update date)
 * Used by git-{provider}-checkout shortcodes
 */
.git-checkout-info {
    margin: 20px 0;
    padding: 15px 20px;
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.git-checkout-info p {
    margin: 8px 0;
    line-height: 1.5;
}

.git-checkout-info p:first-child {
    margin-top: 0;
}

.git-checkout-info p:last-child {
    margin-bottom: 0;
}

.git-checkout-info strong {
    color: #23282d;
    font-weight: 600;
}

/* Checkout links */
.git-checkout-info a {
    color: #0073aa;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.git-checkout-info a:hover {
    color: #005177;
    border-bottom-color: #005177;
}

.git-checkout-info a:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ==========================================================================
   Commit History Styling
   ========================================================================== */

/**
 * Wrapper for commit history display
 * Used by git-{provider}-history shortcodes
 */
.git-history {
    margin: 25px 0;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.git-history h3 {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
    color: #23282d;
    font-size: 1.3em;
    font-weight: 600;
}

/* Commit list */
.git-history .commit-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Individual commit item */
.git-history .commit-item {
    margin: 0 0 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-left: 3px solid #0073aa;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.git-history .commit-item:last-child {
    margin-bottom: 0;
}

.git-history .commit-item:hover {
    background: #f0f1f2;
    border-left-color: #005177;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Commit date */
.git-history .commit-date {
    font-weight: 600;
    color: #0073aa;
    font-size: 0.95em;
    margin-bottom: 8px;
}

/* Commit message */
.git-history .commit-message {
    margin: 8px 0;
    color: #23282d;
    font-size: 1em;
    line-height: 1.5;
}

/* Commit author */
.git-history .commit-author {
    margin-top: 8px;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

/* ==========================================================================
   Error Messages
   ========================================================================== */

/**
 * Error message styling for all error conditions
 * Applied to 404, 401, 403, 500, and timeout errors
 */
.html-from-git-error {
    margin: 20px 0;
    padding: 20px;
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    border-left: 4px solid #dc3545;
    border-radius: 6px;
    color: #721c24;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.1);
}

.html-from-git-error h1 {
    margin: 0 0 10px 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #dc3545;
}

.html-from-git-error p {
    margin: 8px 0 0 0;
    line-height: 1.5;
}

/* Specific error type styling */
.html-from-git-error.error-404 {
    border-left-color: #ffc107;
    background: #fffbf0;
}

.html-from-git-error.error-404 h1 {
    color: #856404;
}

.html-from-git-error.error-401,
.html-from-git-error.error-403 {
    border-left-color: #ff9800;
    background: #fff8f0;
}

.html-from-git-error.error-401 h1,
.html-from-git-error.error-403 h1 {
    color: #e65100;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/**
 * Mobile-friendly adjustments for smaller screens
 */
@media screen and (max-width: 768px) {
    .html-from-git {
        padding: 15px;
        margin: 15px 0;
    }
    
    .git-checkout-info {
        padding: 12px 15px;
    }
    
    .git-history {
        padding: 15px;
    }
    
    .git-history h3 {
        font-size: 1.2em;
    }
    
    .git-history .commit-item {
        padding: 12px;
    }
    
    .html-from-git-error {
        padding: 15px;
    }
}

@media screen and (max-width: 480px) {
    .html-from-git {
        padding: 12px;
        margin: 12px 0;
    }
    
    .git-checkout-info {
        padding: 10px 12px;
    }
    
    .git-history {
        padding: 12px;
    }
    
    .git-history h3 {
        font-size: 1.1em;
        margin-bottom: 15px;
    }
    
    .git-history .commit-item {
        padding: 10px;
        margin-bottom: 12px;
    }
    
    .html-from-git-error {
        padding: 12px;
    }
    
    .html-from-git-error h1 {
        font-size: 1.1em;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

/**
 * Optimized styles for printing
 */
@media print {
    .html-from-git,
    .git-checkout-info,
    .git-history,
    .git-history .commit-item {
        box-shadow: none;
        border-color: #000;
    }
    
    .git-checkout-info a {
        color: #000;
        text-decoration: underline;
    }
    
    .html-from-git-error {
        border: 2px solid #000;
    }
}
