/**
 * CodeMastery Pro Custom CSS
 *
 * Additional custom styles for the theme
 * @package CodeMastery Pro
 * @version 2.0.0
 */

/* Elementor specific fixes */
.elementor-editor-active .site-header {
    position: relative;
}

.elementor-editor-active .language-bar {
    margin-top: 0;
}

/* Fix for admin bar */
body.admin-bar .site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }
}

/* Course card link styling */
.course-card {
    display: block;
    text-decoration: none;
}

.course-card:hover {
    text-decoration: none;
}

/* Tutorial card button spacing */
.tutorial-actions .btn {
    margin-bottom: 5px;
}

/* Form validation styles */
.auth-form input:invalid,
.contact-form input:invalid,
.contact-form textarea:invalid {
    border-color: rgba(255, 0, 0, 0.3);
}

.auth-form input:valid,
.contact-form input:valid,
.contact-form textarea:valid {
    border-color: rgba(4, 170, 109, 0.3);
}

/* Notice styles */
.notice {
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.notice-success {
    background: rgba(4, 170, 109, 0.1);
    border: 1px solid rgba(4, 170, 109, 0.3);
    color: var(--cm-green);
}

.notice-error {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #ff6b6b;
}

.notice-info {
    background: rgba(150, 212, 212, 0.1);
    border: 1px solid rgba(150, 212, 212, 0.3);
    color: var(--cm-blue);
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--cm-white);
    animation: spin 1s ease-in-out infinite;
}

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

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

::-webkit-scrollbar-track {
    background: var(--cm-darker);
}

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

::-webkit-scrollbar-thumb:hover {
    background: #038857;
}

/* Selection color */
::selection {
    background: rgba(4, 170, 109, 0.3);
    color: var(--cm-white);
}

/* Focus styles for accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--cm-green);
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--cm-green);
    color: var(--cm-white);
    padding: 8px 16px;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Print styles */
@media print {
    .site-header,
    .language-bar,
    .site-footer,
    .hero-search,
    .hero-cta,
    .editor-section,
    .pro-section,
    .search-modal,
    .mobile-menu {
        display: none !important;
    }
    
    .hero-section {
        min-height: auto;
        padding: 40px 0;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --cm-green: #00ff00;
        --cm-dark: #000000;
        --cm-darker: #111111;
        --cm-light: #ffffff;
    }
}

/* 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;
    }
    
    .ribbon-track {
        animation: none !important;
    }
}

/* Dark mode is default, but add light mode support */
@media (prefers-color-scheme: light) {
    /* Keep dark theme as default, but could add light theme here */
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    .hero-section {
        min-height: -webkit-fill-available;
    }
}

/* Code block improvements */
pre {
    position: relative;
}

pre::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: #2d2d2d;
    border-radius: 12px 12px 0 0;
}

pre code {
    display: block;
    padding-top: 40px;
}

/* Table styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

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

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

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Definition list styling */
dl {
    margin: 20px 0;
}

dt {
    color: var(--cm-white);
    font-weight: 600;
    margin-top: 15px;
}

dd {
    color: rgba(241, 241, 241, 0.7);
    margin-left: 20px;
    margin-top: 5px;
}

/* Abbreviation styling */
abbr[title] {
    border-bottom: 1px dotted var(--cm-green);
    cursor: help;
}

/* Mark styling */
mark {
    background: var(--cm-yellow);
    color: var(--cm-black);
    padding: 2px 5px;
    border-radius: 3px;
}

/* Keyboard input styling */
kbd {
    background: var(--cm-darker);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 3px 8px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* Sample output styling */
samp {
    background: var(--cm-darker);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--cm-pink);
}

/* Variable styling */
var {
    font-style: italic;
    color: var(--cm-blue);
}

/* Cite styling */
cite {
    font-style: italic;
    color: var(--cm-yellow);
}

/* Small text styling */
small {
    font-size: 0.85em;
    color: rgba(241, 241, 241, 0.6);
}

/* Strong and em styling */
strong {
    color: var(--cm-white);
    font-weight: 700;
}

em {
    color: var(--cm-pink);
}

/* Horizontal rule styling */
hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 40px 0;
}

/* Figure and figcaption styling */
figure {
    margin: 20px 0;
}

figcaption {
    text-align: center;
    color: rgba(241, 241, 241, 0.6);
    font-size: 0.9em;
    margin-top: 10px;
}

/* Details and summary styling */
details {
    background: var(--cm-darker);
    border-radius: 8px;
    padding: 15px 20px;
    margin: 15px 0;
}

summary {
    color: var(--cm-white);
    font-weight: 600;
    cursor: pointer;
}

summary:hover {
    color: var(--cm-green);
}

/* Progress bar styling */
progress {
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: var(--cm-darker);
}

progress::-webkit-progress-bar {
    background: var(--cm-darker);
    border-radius: 5px;
}

progress::-webkit-progress-value {
    background: var(--cm-green);
    border-radius: 5px;
}

progress::-moz-progress-bar {
    background: var(--cm-green);
    border-radius: 5px;
}

/* Meter styling */
meter {
    width: 100%;
    height: 10px;
}

meter::-webkit-meter-bar {
    background: var(--cm-darker);
    border-radius: 5px;
}

meter::-webkit-meter-optimum-value {
    background: var(--cm-green);
    border-radius: 5px;
}

meter::-webkit-meter-suboptimum-value {
    background: var(--cm-yellow);
    border-radius: 5px;
}

meter::-webkit-meter-even-less-good-value {
    background: var(--cm-pink);
    border-radius: 5px;
}
