/**
 * ClkAdmin - Custom Styles
 * Supporto Dark Mode MDB5 Pro
 */

/* Layout */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 0.9rem;
}

main {
    flex: 1;
}

/* Cards */
.card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 0.75rem;
}

.card-sm .card-body {
    padding: 0.5rem 0.75rem;
}

/* Dark mode cards */
[data-mdb-theme="dark"] .card {
    background-color: var(--mdb-tertiary-bg);
    border-color: var(--mdb-border-color);
}

[data-mdb-theme="dark"] .card-header {
    background-color: var(--mdb-secondary-bg);
    border-color: var(--mdb-border-color);
}

/* Light mode card header */
[data-mdb-theme="light"] .card-header {
    background-color: #f8f9fa;
}

/* Tables */
.table th {
    font-weight: 600;
}

[data-mdb-theme="light"] .table th {
    background-color: #f8f9fa;
}

.table-hover tbody tr:hover {
    cursor: pointer;
}

/* Stats cards - no border */
.card.bg-primary,
.card.bg-success,
.card.bg-info,
.card.bg-warning {
    border: none;
}

.card h4 {
    font-size: 1.5rem;
    font-weight: 400;
}

/* Badges */
.badge {
    font-weight: 500;
}

.badge-sm {
    font-size: 0.7rem;
    padding: 0.2em 0.5em;
}

/* Buttons - rimuovi uppercase di MDB5 */
.btn {
    text-transform: none;
}

.btn-sm {
    font-size: 0.8rem;
}

.btn-action {
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
}

/* Search */
.search-box {
    max-width: 250px;
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

.loading::after {
    content: '';
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

[data-mdb-theme="dark"] .loading::after {
    border-color: #444;
    border-top-color: #3498db;
}

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

/* Footer - fixed bottom */
.footer-sm {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 0.8rem;
    z-index: 1020;
    background-color: var(--mdb-body-bg);
}

/* Spazio per footer fisso */
main {
    padding-bottom: 40px;
}

/* Theme toggle button */
#theme-toggle {
    color: rgba(255,255,255,0.8);
    border: none;
    background: transparent;
}

#theme-toggle:hover {
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .card h4 {
        font-size: 1.25rem;
    }

    .card .fa-2x {
        font-size: 1.5rem !important;
    }
}

/* Utilities */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Toast customization */
.toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 9999;
}

.toast-container .toast {
    min-width: 280px;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Small inputs */
.form-control-sm {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.form-select-sm {
    font-size: 0.8rem;
}

/* MDB5 Select small */
.form-select-sm + .select-wrapper .select-input {
    font-size: 0.8rem !important;
    min-height: 30px !important;
    padding: 0.25rem 0.5rem !important;
}

.form-select-sm + .select-wrapper .select-arrow {
    top: 8px !important;
}

.form-select-sm + .select-wrapper .select-dropdown-container .select-option {
    font-size: 0.8rem !important;
    padding: 0.35rem 0.75rem !important;
}

/* Dark mode text adjustments */
[data-mdb-theme="dark"] .text-muted {
    color: var(--mdb-secondary-color) !important;
}

/* Markdown Preview Panel */
.preview-panel {
    border: 1px solid var(--mdb-border-color, #dee2e6);
    border-radius: 0.25rem;
    padding: 1rem;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--mdb-body-bg, #fff);
}

[data-mdb-theme="dark"] .preview-panel {
    background: var(--mdb-tertiary-bg);
    border-color: var(--mdb-border-color);
}

/* Markdown body styling */
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.markdown-body h1 { font-size: 1.5rem; }
.markdown-body h2 { font-size: 1.25rem; }
.markdown-body h3 { font-size: 1.1rem; }

.markdown-body p {
    margin-bottom: 0.75rem;
}

.markdown-body code {
    background: rgba(0,0,0,0.05);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.85em;
}

[data-mdb-theme="dark"] .markdown-body code {
    background: rgba(255,255,255,0.1);
}

.markdown-body pre {
    background: rgba(0,0,0,0.05);
    padding: 0.75rem;
    border-radius: 0.25rem;
    overflow-x: auto;
}

[data-mdb-theme="dark"] .markdown-body pre {
    background: rgba(0,0,0,0.3);
}

.markdown-body ul, .markdown-body ol {
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.markdown-body blockquote {
    border-left: 3px solid var(--mdb-primary);
    padding-left: 1rem;
    margin: 0.75rem 0;
    color: var(--mdb-secondary-color);
}

/* Markdown editor textarea */
.md-editor {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}
