/**
 * Designer Module - Components
 * Modern UI Components
 * 
 * @package    Designer Module
 * @subpackage CSS
 * @author     Kilo Code AI
 * @version    2.0.0
 */

/* ===== BUTTONS ===== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    font-family: var(--font-primary);
    line-height: 1;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    user-select: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary Button */
.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Secondary Button */
.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--border-dark);
    color: var(--text-primary);
}

/* Success Button */
.btn-success {
    background: var(--accent-success);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover:not(:disabled) {
    background: var(--accent-success-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Danger Button */
.btn-danger {
    background: var(--accent-danger);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover:not(:disabled) {
    background: var(--accent-danger-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Icon Button */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    color: var(--text-secondary);
    border: none;
}

.btn-icon:hover:not(:disabled) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
    gap: var(--space-1);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
    gap: var(--space-3);
}

/* ===== INPUTS ===== */

.input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-family: var(--font-primary);
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.input:hover {
    border-color: var(--border-medium);
}

.input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-accent);
}

.input::placeholder {
    color: var(--text-tertiary);
}

.input:disabled {
    background: var(--bg-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Color Input */
.input-color {
    width: 60px;
    height: 40px;
    padding: var(--space-1);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
}

.input-color:hover {
    border-color: var(--border-medium);
}

.input-color:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-accent);
}

/* Range Input */
.input-range {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.input-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.input-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: var(--shadow-md);
}

.input-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    border: none;
}

.input-range::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: var(--shadow-md);
}

.range-value {
    display: inline-block;
    margin-left: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
}

/* Select */
select.input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    padding-right: var(--space-8);
}

/* ===== CARDS ===== */

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    color: var(--text-secondary);
}

/* ===== BADGES ===== */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background: var(--accent-primary-light);
    color: var(--accent-primary-dark);
}

.badge-success {
    background: var(--accent-success-light);
    color: var(--accent-success);
}

.badge-warning {
    background: var(--accent-warning-light);
    color: var(--accent-warning);
}

.badge-danger {
    background: var(--accent-danger-light);
    color: var(--accent-danger);
}

/* ===== ALERTS ===== */

.alert {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.alert-icon {
    flex-shrink: 0;
    font-size: var(--text-lg);
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-1);
}

.alert-message {
    font-size: var(--text-sm);
}

.alert-info {
    background: var(--accent-primary-light);
    border-color: var(--accent-primary);
    color: var(--accent-primary-dark);
}

.alert-success {
    background: var(--accent-success-light);
    border-color: var(--accent-success);
    color: #065F46;
}

.alert-warning {
    background: var(--accent-warning-light);
    border-color: var(--accent-warning);
    color: #92400E;
}

.alert-danger {
    background: var(--accent-danger-light);
    border-color: var(--accent-danger);
    color: #991B1B;
}

/* ===== LOADING ===== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-4);
    z-index: var(--z-modal);
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

.loading-overlay p {
    color: white;
    font-size: var(--text-base);
    font-weight: var(--font-medium);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== TOOLTIPS ===== */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: var(--space-2) var(--space-3);
    background: var(--text-primary);
    color: white;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
    z-index: var(--z-tooltip);
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* Tooltip Positions */
[data-tooltip-position="right"]::after {
    bottom: auto;
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(8px);
}

[data-tooltip-position="left"]::after {
    bottom: auto;
    left: auto;
    right: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(-8px);
}

[data-tooltip-position="top"]::after {
    bottom: 100%;
    transform: translateX(-50%) translateY(-8px);
}

[data-tooltip-position="bottom"]::after {
    bottom: auto;
    top: 100%;
    transform: translateX(-50%) translateY(8px);
}

/* ===== DIVIDERS ===== */

.divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-4) 0;
}

.divider-vertical {
    width: 1px;
    height: auto;
    background: var(--border-light);
    margin: 0 var(--space-4);
}

/* ===== TOGGLE BUTTONS ===== */

.toggle-group {
    display: flex;
    gap: var(--space-2);
}

.toggle-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    user-select: none;
}

.toggle-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.toggle-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.toggle-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== KEYBOARD SHORTCUTS ===== */

kbd {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    line-height: 1;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 0 var(--border-dark);
}

/* ===== EMPTY STATES ===== */

.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--text-tertiary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.3;
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.empty-state-message {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

/* ===== UTILITY CLASSES ===== */

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.font-medium {
    font-weight: var(--font-medium);
}

.font-semibold {
    font-weight: var(--font-semibold);
}

.font-bold {
    font-weight: var(--font-bold);
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}
