/* ==========================================================================
   RAVENCRAFT STUDIO - CENTRAL UI CONTROLS (studio_ui.css)
   Overholder Studio Architecture Mandate: Nul hardcodet styling.
   Alle styles er 100% drevet af centrale CSS Custom Properties.
   ========================================================================== */

:root {
    --studio-org-primary: var(--primary, #0070f3);
    --studio-card-bg: var(--card-bg, #ffffff);
    --studio-dark: var(--dark, #0f172a);
    --studio-border: var(--border, #e2e8f0);
    --studio-bg: var(--bg, #f8fafc);
    --studio-danger: var(--danger, #ef4444);
    --studio-success: var(--success, #10b981);
    --studio-warning: var(--warning, #f59e0b);
    --studio-muted: #64748b;
    --studio-radius-sm: 6px;
    --studio-radius-md: 10px;
    --studio-radius-lg: 16px;
    --studio-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --studio-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --studio-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

/* --------------------------------------------------------------------------
   1. BUTTONS (.studio-btn & Aliases)
   -------------------------------------------------------------------------- */
.studio-btn,
.btn,
.btn-action,
.btn-save,
.btn-back,
.btn-nav,
.btn-log,
.btn-edit,
.btn-upload-choice,
.btn-next,
.btn-smiley,
.btn-choice,
.btn-matrix-option,
.btn-comment-trigger,
.tag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    padding: 10px 18px;
    border-radius: var(--studio-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
    box-sizing: border-box;
    vertical-align: middle;
}

.studio-btn:active,
.btn:active,
.btn-action:active {
    transform: scale(0.98);
}

.studio-btn:disabled,
.studio-btn.disabled,
.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary */
.studio-btn-primary,
.btn-primary,
.btn-save,
button[type="submit"]:not(.studio-btn-secondary):not(.studio-btn-danger):not(.btn-secondary):not(.btn-danger):not(.btn-link) {
    background: var(--studio-org-primary) !important;
    color: #ffffff !important;
    border-color: var(--studio-org-primary) !important;
}

.studio-btn-primary:hover,
.btn-primary:hover,
.btn-save:hover {
    filter: brightness(1.08);
}

/* Secondary */
.studio-btn-secondary,
.btn-secondary,
.btn-back {
    background: var(--studio-bg) !important;
    color: var(--studio-dark) !important;
    border-color: var(--studio-border) !important;
}

.studio-btn-secondary:hover,
.btn-secondary:hover,
.btn-back:hover {
    background: var(--studio-border) !important;
}

/* Outline */
.studio-btn-outline,
.btn-outline {
    background: transparent !important;
    color: var(--studio-org-primary) !important;
    border-color: var(--studio-org-primary) !important;
}

.studio-btn-outline:hover,
.btn-outline:hover {
    background: var(--studio-org-primary) !important;
    color: #ffffff !important;
}

/* Danger / Delete */
.studio-btn-danger,
.btn-danger,
.btn-delete {
    background: var(--studio-danger) !important;
    color: #ffffff !important;
    border-color: var(--studio-danger) !important;
}

.studio-btn-danger:hover,
.btn-danger:hover,
.btn-delete:hover {
    filter: brightness(1.08);
}

/* Success */
.studio-btn-success,
.btn-success {
    background: var(--studio-success) !important;
    color: #ffffff !important;
    border-color: var(--studio-success) !important;
}

.studio-btn-success:hover,
.btn-success:hover {
    filter: brightness(1.08);
}

/* Link Style */
.studio-btn-link,
.btn-link {
    background: transparent !important;
    color: var(--studio-org-primary) !important;
    border: none !important;
    padding: 0 !important;
    text-decoration: underline !important;
    font-weight: 600;
    box-shadow: none !important;
}

.studio-btn-link:hover,
.btn-link:hover {
    opacity: 0.8;
}

/* Button Sizes */
.studio-btn-sm,
.btn-sm {
    padding: 6px 12px;
    font-size: 12.5px;
    border-radius: var(--studio-radius-sm);
}

.studio-btn-lg,
.btn-lg {
    padding: 14px 26px;
    font-size: 16px;
    border-radius: var(--studio-radius-md);
}

/* Button Group */
.studio-btn-group,
.btn-group {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* --------------------------------------------------------------------------
   2. CARDS & CONTAINERS (.studio-card & Aliases)
   -------------------------------------------------------------------------- */
.studio-card,
.card,
.panel {
    background: var(--studio-card-bg) !important;
    border: 1px solid var(--studio-border) !important;
    border-radius: var(--studio-radius-md);
    color: var(--studio-dark) !important;
    padding: 24px;
    box-shadow: var(--studio-shadow-sm);
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.studio-card-header,
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--studio-border);
}

.studio-card-title,
.card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--studio-dark);
}

.studio-card-body,
.card-body {
    color: var(--studio-dark);
    line-height: 1.6;
}

.studio-card-footer,
.card-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--studio-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.studio-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* --------------------------------------------------------------------------
   3. FORM INPUTS & CONTROLS (.studio-input & Aliases)
   -------------------------------------------------------------------------- */
.studio-form-group,
.form-group {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.studio-label,
.form-label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--studio-dark);
    margin: 0;
}

.studio-input,
.studio-select,
.studio-textarea,
.form-control,
.form-select,
input[type="text"]:not([class*="studio-"]),
input[type="email"]:not([class*="studio-"]),
input[type="password"]:not([class*="studio-"]),
input[type="url"]:not([class*="studio-"]),
input[type="number"]:not([class*="studio-"]),
select:not([class*="studio-"]):not(.custom-no-style),
textarea:not([class*="studio-"]):not(.custom-no-style) {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    color: var(--studio-dark) !important;
    background: var(--studio-card-bg) !important;
    border: 1px solid var(--studio-border) !important;
    border-radius: var(--studio-radius-sm);
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.studio-input:focus,
.studio-select:focus,
.studio-textarea:focus,
.form-control:focus,
.form-select:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--studio-org-primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 112, 243, 0.15);
}

.studio-textarea,
textarea.form-control {
    min-height: 90px;
    resize: vertical;
}

.studio-input-hint {
    font-size: 12px;
    color: var(--studio-muted);
    margin-top: 2px;
}

.studio-input-error {
    font-size: 12px;
    color: var(--studio-danger);
    margin-top: 2px;
}

/* --------------------------------------------------------------------------
   4. MODALS & LIGHTBOXES (.studio-modal & Aliases)
   -------------------------------------------------------------------------- */
.studio-modal-backdrop,
.modal-backdrop,
.modal-overlay,
.db-modal-overlay,
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.studio-modal-backdrop.open,
.modal-backdrop.open,
.modal-overlay.open,
.db-modal-overlay.open,
.lightbox.open,
.studio-modal-backdrop[style*="display: flex"],
.modal-backdrop[style*="display: flex"],
.modal-overlay[style*="display: flex"],
.db-modal-overlay[style*="display: flex"],
.lightbox[style*="display: flex"] {
    display: flex;
    opacity: 1;
}

.studio-modal-card,
.modal-card,
.db-modal-card,
.showcase-modal-card,
.lightbox-content {
    background: var(--studio-card-bg) !important;
    border: 1px solid var(--studio-border) !important;
    border-radius: var(--studio-radius-lg);
    box-shadow: var(--studio-shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.96);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.studio-modal-backdrop.open .studio-modal-card,
.modal-backdrop.open .modal-card,
.modal-overlay.open .modal-card,
.db-modal-overlay.open .db-modal-card,
.studio-modal-backdrop[style*="display: flex"] .studio-modal-card,
.modal-backdrop[style*="display: flex"] .modal-card,
.modal-overlay[style*="display: flex"] .modal-card,
.db-modal-overlay[style*="display: flex"] .db-modal-card {
    transform: scale(1);
}

.studio-modal-header,
.modal-header,
.db-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--studio-border);
    background: var(--studio-card-bg);
}

.studio-modal-title,
.modal-title,
.db-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--studio-dark);
}

.studio-modal-close,
.modal-close,
.modal-close-x,
.db-modal-close,
.close-btn {
    background: none;
    border: none;
    color: var(--studio-dark);
    opacity: 0.6;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: opacity 0.15s ease;
}

.studio-modal-close:hover,
.modal-close:hover,
.modal-close-x:hover,
.db-modal-close:hover,
.close-btn:hover {
    opacity: 1;
}

.studio-modal-body,
.modal-body,
.db-modal-body {
    padding: 24px;
    overflow-y: auto;
    color: var(--studio-dark);
    line-height: 1.6;
}

.studio-modal-footer,
.modal-footer,
.db-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--studio-border);
    background: var(--studio-bg);
}

/* --------------------------------------------------------------------------
   5. BADGES & ALERTS (.studio-badge & .studio-alert)
   -------------------------------------------------------------------------- */
.studio-badge,
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    border: 1px solid transparent;
}

.studio-badge-primary,
.badge-primary {
    background: rgba(0, 112, 243, 0.12);
    color: var(--studio-org-primary);
    border-color: rgba(0, 112, 243, 0.25);
}

.studio-badge-success,
.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--studio-success);
    border-color: rgba(16, 185, 129, 0.25);
}

.studio-badge-warning,
.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--studio-warning);
    border-color: rgba(245, 158, 11, 0.25);
}

.studio-badge-danger,
.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--studio-danger);
    border-color: rgba(239, 68, 68, 0.25);
}

.studio-alert,
.alert {
    padding: 14px 18px;
    border-radius: var(--studio-radius-sm);
    margin-bottom: 18px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid transparent;
}

.studio-alert-info,
.alert-info {
    background: rgba(0, 112, 243, 0.08);
    border-color: rgba(0, 112, 243, 0.2);
    color: var(--studio-dark);
}

.studio-alert-success,
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    color: var(--studio-dark);
}

.studio-alert-warning,
.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.25);
    color: var(--studio-dark);
}

.studio-alert-danger,
.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: var(--studio-dark);
}
