/*  
   Pixel-Art CSS Framework Add-on for Bootstrap Inspired UI
   Features retro pixel art styles, arcade themes, round buttons, sprite animations, CRT effects, etc.
   
   Usage: 
   - Simply include this file after your main CSS or Bootstrap CSS.
   - Customize the pixel art theme by adjusting the CSS variables defined below.
*/

/* ----------- Pixel Art Variables -------------- */
:root {
    --pixelart-font-family: 'Press Start 2P', monospace; /* Pixelated font for retro look */
    --pixelart-primary-color: #ffcb00; /* Amber yellow for main accents */
    --pixelart-secondary-color: #009a44; /* Green for secondary accents (CRT effect) */
    --pixelart-border-radius: 3px; /* Rounded corners for buttons */
    --pixelart-font-size: 16px; /* Base font size for pixel art */
    --pixelart-shadow: rgba(0, 0, 0, 0.5); /* Shadow for depth */
    --pixelart-button-padding: 10px 20px; /* Padding for round buttons */
    --pixelart-button-border: 2px solid #000; /* Pixel perfect button borders */
    --pixelart-sprite-width: 32px; /* Sprite width (32x32) */
    --pixelart-sprite-height: 32px; /* Sprite height (32x32) */
    --pixelart-crt-strength: 10%; /* CRT curvature strength */
}

/* ----------- Base Pixel Art Font Setup -------------- */
body {
    font-family: var(--pixelart-font-family), monospace;
    font-size: var(--pixelart-font-size);
    color: #fff; /* Default text color */
    background-color: #000; /* Default background color */
}

/* ----------- Amber-Green CRT Effect -------------- */
.crt {
    filter: contrast(120%) brightness(110%) hue-rotate(-20deg);
    transform: rotate(5deg);
    background: radial-gradient(circle, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.4) 80%);
    border-radius: 20px;
    box-shadow: 0 0 20px 5px var(--pixelart-primary-color);
}

/* Use this class on containers to apply a CRT screen effect to a pixel art page */
.crt-container {
    overflow: hidden;
    padding: 20px;
}

/* ----------- Pixelated Buttons (Round) -------------- */
.button-pixel {
    display: inline-block;
    font-size: var(--pixelart-font-size);
    padding: var(--pixelart-button-padding);
    border-radius: var(--pixelart-border-radius);
    border: var(--pixelart-button-border);
    background-color: var(--pixelart-primary-color);
    color: #000;
    text-align: center;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.button-pixel:hover {
    background-color: var(--pixelart-secondary-color);
    box-shadow: 0 0 10px var(--pixelart-shadow);
}

/* ----------- Pixel Sprite Animation -------------- */
.sprite {
    width: var(--pixelart-sprite-width);
    height: var(--pixelart-sprite-height);
    background: url('path/to/sprite-sheet.png') no-repeat;
    animation: sprite-animation 0.5s steps(4) infinite; /* Change steps according to sprite sheet frames */
}

/* Define sprite keyframe animations for a 4-frame sprite sheet */
@keyframes sprite-animation {
    0% { background-position: 0 0; }
    25% { background-position: -32px 0; }
    50% { background-position: -64px 0; }
    75% { background-position: -96px 0; }
    100% { background-position: 0 0; }
}

/* ----------- Pixel Border Helpers -------------- */
.border-pixel {
    border: 3px solid #000; /* Thick, sharp borders typical of pixel art */
}

/* ----------- Pixel Art Containers -------------- */
.container-pixel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 5px;
    padding: 10px;
}

.item-pixel {
    background-color: #111;
    padding: 15px;
    border: 2px solid #444;
    text-align: center;
    font-size: var(--pixelart-font-size);
    box-shadow: 2px 2px 5px var(--pixelart-shadow);
}

.item-pixel:hover {
    background-color: var(--pixelart-primary-color);
    color: #000;
    box-shadow: 0 0 15px var(--pixelart-shadow);
}

/* ----------- Pixelated Background Helpers -------------- */
.bg-pixel {
    background: url('path/to/pixel-background.png') repeat;
    background-size: 32px 32px; /* Background repeat pattern with 32x32 pixel tiles */
}

/* ----------- Responsive Design (Mobile-Friendly) -------------- */
@media (max-width: 768px) {
    .button-pixel {
        font-size: 14px;
        padding: 8px 16px;
    }

    .container-pixel {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .item-pixel {
        padding: 12px;
    }
}

/* ----------- Utilities for Pixel Art Specific Properties -------------- */

/* Make an element appear pixelated */
.pixelated {
    image-rendering: pixelated; /* Prevent image smoothing for pixel-perfect display */
    -webkit-image-rendering: pixelated; /* For Safari */
    -moz-image-rendering: pixelated; /* For Firefox */
}

/* Apply pixelated borders to elements */
.pixel-border {
    border: 2px solid #fff; /* Use white for contrast on dark backgrounds */
}

/* ----------- Pixel Art Cards -------------- */
.card-pixel {
    background-color: #1a1a1a;
    border: 3px solid #333;
    box-shadow: 4px 4px 0 #000;
    padding: 20px;
    margin: 10px;
    position: relative;
}

.card-pixel:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #000;
}

.card-pixel-header {
    border-bottom: 2px solid var(--pixelart-primary-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 14px;
}

.card-pixel-body {
    line-height: 1.6;
}

.card-pixel-footer {
    border-top: 2px solid #333;
    padding-top: 10px;
    margin-top: 15px;
    font-size: 12px;
    color: #888;
}

/* ----------- Pixel Art Badges -------------- */
.badge-pixel {
    display: inline-block;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    border: 2px solid #000;
    background-color: var(--pixelart-primary-color);
    color: #000;
    box-shadow: 2px 2px 0 #000;
}

.badge-pixel-success {
    background-color: #00ff00;
}

.badge-pixel-danger {
    background-color: #ff0000;
    color: #fff;
}

.badge-pixel-info {
    background-color: #00ffff;
}

.badge-pixel-warning {
    background-color: #ff8800;
}

/* ----------- Pixel Art Alert Boxes -------------- */
.alert-pixel {
    padding: 15px 20px;
    margin: 10px 0;
    border: 3px solid #000;
    position: relative;
    background-color: #1a1a1a;
    box-shadow: 4px 4px 0 #000;
}

.alert-pixel::before {
    content: '!';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background-color: var(--pixelart-primary-color);
    border: 2px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 2px 2px 0 #000;
}

.alert-pixel-success {
    border-color: #00ff00;
}

.alert-pixel-success::before {
    content: '✓';
    background-color: #00ff00;
}

.alert-pixel-danger {
    border-color: #ff0000;
}

.alert-pixel-danger::before {
    background-color: #ff0000;
}

.alert-pixel-info {
    border-color: #00ffff;
}

.alert-pixel-info::before {
    content: 'i';
    background-color: #00ffff;
    color: #000;
}

/* ----------- Pixel Art Progress Bars -------------- */
.progress-pixel {
    width: 100%;
    height: 24px;
    background-color: #1a1a1a;
    border: 3px solid #333;
    position: relative;
    overflow: hidden;
    box-shadow: inset 2px 2px 0 #000;
}

.progress-pixel-bar {
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        var(--pixelart-primary-color) 0px,
        var(--pixelart-primary-color) 4px,
        #ffdd00 4px,
        #ffdd00 8px
    );
    transition: width 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: #000;
}

.progress-pixel-bar-animated {
    animation: progress-shimmer 1s linear infinite;
}

@keyframes progress-shimmer {
    0% { background-position: 0 0; }
    100% { background-position: 8px 0; }
}

/* ----------- Pixel Art Tables -------------- */
.table-pixel {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 3px solid #333;
}

.table-pixel thead {
    background-color: var(--pixelart-primary-color);
    color: #000;
}

.table-pixel th,
.table-pixel td {
    padding: 10px;
    text-align: left;
    border: 2px solid #333;
    font-size: 12px;
}

.table-pixel tbody tr:hover {
    background-color: #2a2a2a;
}

.table-pixel tbody tr:nth-child(even) {
    background-color: #1a1a1a;
}

.table-pixel tbody tr:nth-child(odd) {
    background-color: #0f0f0f;
}

/* ----------- Pixel Art Tooltips -------------- */
.tooltip-pixel {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip-pixel::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background-color: #000;
    color: var(--pixelart-primary-color);
    border: 2px solid var(--pixelart-primary-color);
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.5);
}

.tooltip-pixel::after {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--pixelart-primary-color);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tooltip-pixel:hover::before,
.tooltip-pixel:hover::after {
    opacity: 1;
}

/* ----------- Pixel Art Input Fields -------------- */
.input-pixel {
    padding: 10px;
    font-size: 14px;
    font-family: var(--pixelart-font-family), monospace;
    background-color: #1a1a1a;
    border: 3px solid #333;
    color: #fff;
    outline: none;
    transition: all 0.2s;
}

.input-pixel:focus {
    border-color: var(--pixelart-primary-color);
    box-shadow: 0 0 10px rgba(255, 203, 0, 0.5);
}

.input-pixel::placeholder {
    color: #666;
}

/* ----------- Pixel Art Textarea -------------- */
.textarea-pixel {
    padding: 10px;
    font-size: 14px;
    font-family: var(--pixelart-font-family), monospace;
    background-color: #1a1a1a;
    border: 3px solid #333;
    color: #fff;
    outline: none;
    resize: vertical;
    min-height: 100px;
    transition: all 0.2s;
}

.textarea-pixel:focus {
    border-color: var(--pixelart-primary-color);
    box-shadow: 0 0 10px rgba(255, 203, 0, 0.5);
}

/* ----------- Pixel Art Checkboxes -------------- */
.checkbox-pixel {
    display: inline-block;
    position: relative;
    cursor: pointer;
    user-select: none;
    padding-left: 30px;
    line-height: 20px;
}

.checkbox-pixel input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-pixel .checkmark {
    position: absolute;
    left: 0;
    top: 0;
    height: 20px;
    width: 20px;
    background-color: #1a1a1a;
    border: 3px solid #333;
}

.checkbox-pixel:hover .checkmark {
    border-color: var(--pixelart-primary-color);
}

.checkbox-pixel input:checked ~ .checkmark {
    background-color: var(--pixelart-primary-color);
}

.checkbox-pixel .checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 4px;
    top: 0px;
    width: 6px;
    height: 12px;
    border: solid #000;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.checkbox-pixel input:checked ~ .checkmark::after {
    display: block;
}

/* ----------- Pixel Art Radio Buttons -------------- */
.radio-pixel {
    display: inline-block;
    position: relative;
    cursor: pointer;
    user-select: none;
    padding-left: 30px;
    line-height: 20px;
}

.radio-pixel input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-pixel .radiomark {
    position: absolute;
    left: 0;
    top: 0;
    height: 20px;
    width: 20px;
    background-color: #1a1a1a;
    border: 3px solid #333;
}

.radio-pixel:hover .radiomark {
    border-color: var(--pixelart-primary-color);
}

.radio-pixel input:checked ~ .radiomark {
    background-color: var(--pixelart-primary-color);
}

.radio-pixel .radiomark::after {
    content: '';
    position: absolute;
    display: none;
    left: 3px;
    top: 3px;
    width: 8px;
    height: 8px;
    background-color: #000;
}

.radio-pixel input:checked ~ .radiomark::after {
    display: block;
}

/* ----------- Pixel Art Modals -------------- */
.modal-pixel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9998;
}

.modal-pixel-overlay.active {
    display: block;
}

.modal-pixel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #1a1a1a;
    border: 4px solid var(--pixelart-primary-color);
    box-shadow: 8px 8px 0 #000;
    z-index: 9999;
    max-width: 600px;
    width: 90%;
}

.modal-pixel.active {
    display: block;
}

.modal-pixel-header {
    padding: 15px 20px;
    background-color: var(--pixelart-primary-color);
    color: #000;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-pixel-close {
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0 5px;
}

.modal-pixel-close:hover {
    color: #ff0000;
}

.modal-pixel-body {
    padding: 20px;
}

.modal-pixel-footer {
    padding: 15px 20px;
    border-top: 2px solid #333;
    text-align: right;
}

/* ----------- Pixel Art Tabs -------------- */
.tabs-pixel {
    display: flex;
    border-bottom: 3px solid #333;
    margin-bottom: 20px;
}

.tab-pixel {
    padding: 10px 20px;
    background-color: #1a1a1a;
    border: 3px solid #333;
    border-bottom: none;
    margin-right: 5px;
    cursor: pointer;
    font-size: 12px;
    text-transform: uppercase;
    position: relative;
    top: 3px;
}

.tab-pixel:hover {
    background-color: #2a2a2a;
}

.tab-pixel.active {
    background-color: var(--pixelart-primary-color);
    color: #000;
    top: 0;
}

.tab-content-pixel {
    display: none;
    padding: 20px;
    border: 3px solid #333;
    background-color: #1a1a1a;
}

.tab-content-pixel.active {
    display: block;
}

/* ----------- Pixel Art Loading Spinner -------------- */
.spinner-pixel {
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top: 4px solid var(--pixelart-primary-color);
    animation: spin-pixel 0.8s linear infinite;
}

@keyframes spin-pixel {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ----------- Pixel Art Breadcrumbs -------------- */
.breadcrumb-pixel {
    display: flex;
    list-style: none;
    padding: 10px 0;
    margin: 0;
    font-size: 12px;
}

.breadcrumb-pixel li {
    margin-right: 5px;
}

.breadcrumb-pixel li::after {
    content: '>';
    margin-left: 5px;
    color: #666;
}

.breadcrumb-pixel li:last-child::after {
    content: '';
}

.breadcrumb-pixel a {
    color: var(--pixelart-primary-color);
    text-decoration: none;
}

.breadcrumb-pixel a:hover {
    text-decoration: underline;
}

/* ----------- Pixel Art Pagination -------------- */
.pagination-pixel {
    display: flex;
    list-style: none;
    padding: 0;
    gap: 5px;
}

.pagination-pixel li {
    display: inline-block;
}

.pagination-pixel a,
.pagination-pixel span {
    display: block;
    padding: 8px 12px;
    background-color: #1a1a1a;
    border: 3px solid #333;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
}

.pagination-pixel a:hover {
    background-color: var(--pixelart-primary-color);
    color: #000;
    border-color: var(--pixelart-primary-color);
}

.pagination-pixel .active span {
    background-color: var(--pixelart-primary-color);
    color: #000;
    border-color: var(--pixelart-primary-color);
}

/* ----------- Pixel Art Dividers -------------- */
.divider-pixel {
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        var(--pixelart-primary-color) 0px,
        var(--pixelart-primary-color) 4px,
        transparent 4px,
        transparent 8px
    );
    margin: 20px 0;
}

/* ----------- Pixel Art Grid System -------------- */
.row-pixel {
    display: flex;
    flex-wrap: wrap;
    margin: -10px;
}

.col-pixel {
    flex: 1;
    padding: 10px;
    min-width: 0;
}

.col-pixel-1 { flex: 0 0 8.333%; max-width: 8.333%; }
.col-pixel-2 { flex: 0 0 16.666%; max-width: 16.666%; }
.col-pixel-3 { flex: 0 0 25%; max-width: 25%; }
.col-pixel-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-pixel-5 { flex: 0 0 41.666%; max-width: 41.666%; }
.col-pixel-6 { flex: 0 0 50%; max-width: 50%; }
.col-pixel-7 { flex: 0 0 58.333%; max-width: 58.333%; }
.col-pixel-8 { flex: 0 0 66.666%; max-width: 66.666%; }
.col-pixel-9 { flex: 0 0 75%; max-width: 75%; }
.col-pixel-10 { flex: 0 0 83.333%; max-width: 83.333%; }
.col-pixel-11 { flex: 0 0 91.666%; max-width: 91.666%; }
.col-pixel-12 { flex: 0 0 100%; max-width: 100%; }

/* ----------- Pixel Art Health/Mana Bars -------------- */
.bar-pixel-health,
.bar-pixel-mana {
    width: 100%;
    height: 20px;
    background-color: #1a1a1a;
    border: 3px solid #333;
    position: relative;
    overflow: hidden;
}

.bar-pixel-health-fill {
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        #ff0000 0px,
        #ff0000 4px,
        #cc0000 4px,
        #cc0000 8px
    );
    transition: width 0.3s ease;
}

.bar-pixel-mana-fill {
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        #0000ff 0px,
        #0000ff 4px,
        #0000cc 4px,
        #0000cc 8px
    );
    transition: width 0.3s ease;
}

/* ----------- Pixel Art Dropdown -------------- */
.dropdown-pixel {
    position: relative;
    display: inline-block;
}

.dropdown-pixel-toggle {
    padding: 10px 20px;
    background-color: var(--pixelart-primary-color);
    border: 3px solid #000;
    color: #000;
    cursor: pointer;
    font-size: 14px;
    text-transform: uppercase;
}

.dropdown-pixel-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #1a1a1a;
    border: 3px solid #333;
    box-shadow: 4px 4px 0 #000;
    min-width: 200px;
    z-index: 1000;
}

.dropdown-pixel.active .dropdown-pixel-menu {
    display: block;
}

.dropdown-pixel-item {
    padding: 10px 15px;
    border-bottom: 2px solid #333;
    cursor: pointer;
    font-size: 12px;
}

.dropdown-pixel-item:last-child {
    border-bottom: none;
}

.dropdown-pixel-item:hover {
    background-color: var(--pixelart-primary-color);
    color: #000;
}

/* ----------- Pixel Art Scrollbar -------------- */
::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
    border: 2px solid #333;
}

::-webkit-scrollbar-thumb {
    background: var(--pixelart-primary-color);
    border: 2px solid #000;
}

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

/* ----------- Pixel Art Code Block -------------- */
.code-pixel {
    background-color: #0a0a0a;
    border: 3px solid #333;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    overflow-x: auto;
    line-height: 1.6;
    box-shadow: inset 2px 2px 0 #000;
}

.code-pixel-inline {
    display: inline;
    padding: 2px 6px;
    background-color: #0a0a0a;
    border: 2px solid #333;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* Simple syntax highlighting - no external dependencies */
.code-pixel .number { color: #ff6b9d; }
.code-pixel .string { color: #a8ff60; }
.code-pixel .keyword { color: #96cbfe; }
.code-pixel .function { color: #ffffb6; }
.code-pixel .comment { color: #666; }
.code-pixel .operator { color: #ff8c00; }
.code-pixel .tag { color: #96cbfe; }
.code-pixel .attr { color: #ffcb6b; }
.code-pixel .punctuation { color: #ccc; }

/* ----------- Pixel Art Accordion -------------- */
.accordion-pixel {
    border: 3px solid #333;
    margin: 10px 0;
}

.accordion-pixel-item {
    border-bottom: 2px solid #333;
}

.accordion-pixel-item:last-child {
    border-bottom: none;
}

.accordion-pixel-header {
    padding: 15px;
    background-color: #1a1a1a;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-pixel-header:hover {
    background-color: #2a2a2a;
}

.accordion-pixel-header::after {
    content: '+';
    font-size: 20px;
    color: var(--pixelart-primary-color);
}

.accordion-pixel-header.active::after {
    content: '-';
}

.accordion-pixel-body {
    display: none;
    padding: 15px;
    background-color: #0a0a0a;
}

.accordion-pixel-body.active {
    display: block;
}

/* ----------- Pixel Art Achievement Badge -------------- */
.achievement-pixel {
    display: inline-flex;
    align-items: center;
    padding: 10px 15px;
    background-color: #1a1a1a;
    border: 3px solid var(--pixelart-primary-color);
    box-shadow: 4px 4px 0 #000;
    margin: 5px;
}

.achievement-pixel-icon {
    width: 32px;
    height: 32px;
    background-color: var(--pixelart-primary-color);
    border: 2px solid #000;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.achievement-pixel-text {
    font-size: 12px;
    text-transform: uppercase;
}

/* ----------- Usage Instructions -------------- */
/*
    To use the pixel art base:
    - Add the class 'crt' to any container to apply a CRT effect (e.g., a large pixel art section or an entire page).
    - Use the class 'button-pixel' for any button to give it a rounded, retro look.
    - The 'sprite' class applies to elements using sprite animations; you can customize the background image and animation steps for your sprites.
    - Use the 'container-pixel' class for responsive pixel art grid layouts.
    - Use the 'bg-pixel' class for tiled pixelated backgrounds.
    - Add '.pixelated' to images to prevent smoothing and make them appear pixelated.
*/

