/**
 * BizDMP Design System - Card Components
 * Template cards, stat cards, and card-based layouts
 */

/* Template Cards - 3D Glassmorphic Design */
.template-card {
    width: 280px; /* Fixed width for Masonry.js */
    background: linear-gradient(135deg, var(--color-glass-light), var(--color-glass-subtle));
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
    margin-bottom: var(--space-xl); /* Vertical spacing between cards */
}

.template-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-2xl);
    padding: var(--space-xs);
    background: var(--gradient-primary-alt);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s;
}

.template-card:hover::before {
    opacity: 1;
    animation: borderGlow 3s linear infinite;
}

@keyframes borderGlow {
    0%, 100% { filter: hue-rotate(0deg) brightness(1.2); }
    var(--radius-full) { filter: hue-rotate(30deg) brightness(1.5); }
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 var(--space-lg) var(--space-4xl) var(--shadow-glow-primary);
}

.template-preview {
    /* Simple block container - let content determine height for masonry */
    position: relative;
    width: 100%;
}

.template-preview-canvas {
    /* Simple wrapper - TemplateRenderer sets dimensions */
    width: 100%;
    position: relative;
}

.template-card:hover .template-preview-canvas {
    transform: scale(1);
}

.template-preview-content {
    text-align: center;
    z-index: 2;
}

.template-icon {
    font-size: var(--font-4xl);
    margin-bottom: var(--space-md);
    opacity: 0.9;
}

.template-title {
    font-size: var(--font-lg);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    text-shadow: 0 var(--space-xs) var(--space-sm) rgba(0, 0, 0, var(--opacity-strong));
}

/* Icon Badge (replaces text badge) */
/* DEPRECATED - Old icon badge in top-left (replaced by template-type-badge in top-right) */
.icon-badge {
    display: none;
}

/* Action Icons at Top-Right */
.template-actions-top {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    display: flex;
    gap: var(--space-sm);
    z-index: 10;
    opacity: 0.85; /* Always visible with slight transparency */
    transform: translateY(0);
    transition: all 0.3s ease;
}

.template-card:hover .template-actions-top {
    opacity: 1; /* Full opacity on hover */
    transform: scale(1.05); /* Slight scale up on hover */
}

.action-icon-group {
    display: flex;
    gap: var(--space-md);
}

.action-icon {
    position: relative;
    width: 32px; /* Increased from 26px */
    height: 32px; /* Increased from 26px */
    background: rgba(0, 0, 0, var(--opacity-solid)); /* Dark background for better contrast */
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: var(--font-base); /* Increased from --font-sm */
    color: var(--color-text-primary);
    box-shadow: var(--shadow-sm); /* Added shadow */
}

.action-icon::after {
    content: attr(title);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: var(--color-bg-elevated); /* Dark glassmorphic background */
    backdrop-filter: blur(20px); /* Stronger blur */
    border: 1px solid var(--color-border-medium); /* Subtle border */
    color: white; /* White text on dark background */
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: var(--font-xs);
    font-weight: var(--font-semibold);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    z-index: 1000;
    box-shadow: var(--shadow-md); /* Stronger shadow */
}

.action-icon:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(4px);
}

.action-icon:hover {
    background: var(--color-glass-medium); /* Brighter on hover */
    transform: scale(1.15); /* Increased scale */
    box-shadow: var(--shadow-md); /* Stronger shadow */
}

.action-icon.view:hover {
    background: var(--color-primary); /* Solid primary color */
    border-color: var(--color-primary);
    color: white;
}

.action-icon.edit:hover {
    background: var(--color-warning); /* Solid warning color */
    border-color: var(--color-warning);
    color: white;
}

.action-icon.copy:hover {
    background: var(--color-success); /* Solid success color */
    border-color: var(--color-success);
    color: white;
}

.action-icon.delete:hover {
    background: var(--color-error); /* Solid error color */
    border-color: var(--color-error);
    color: white;
}

/* Template Type Badge - Icon Only */
.template-type-badge {
    position: relative;
    width: 26px;
    height: 26px;
    background: rgba(0, 0, 0, var(--opacity-solid));
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-sm);
    cursor: help;
}

.template-type-badge::after {
    content: attr(title);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: var(--color-bg-elevated); /* Dark glassmorphic background */
    backdrop-filter: blur(20px); /* Stronger blur */
    border: 1px solid var(--color-border-medium); /* Subtle border */
    color: white; /* White text on dark background */
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: var(--font-xs);
    font-weight: var(--font-semibold);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    z-index: 1000;
    box-shadow: var(--shadow-md); /* Stronger shadow */
}

.template-type-badge:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(4px);
}

/* DEPRECATED - Old text badge */
.template-badge {
    display: none; /* Replaced by .icon-badge */
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    padding: var(--radius-md) var(--space-md);
    background: rgba(102, 126, 234, var(--opacity-near-full));
    backdrop-filter: blur(10px);
    border-radius: var(--radius-3xl);
    font-size: var(--font-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: white;
    z-index: 10;
}

.template-delete-btn {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    padding: var(--radius-md) var(--space-sm);
    background: var(--color-overlay-strong);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-lg);
    color: var(--color-text-primary);
    font-size: var(--font-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 3;
    opacity: 0;
    transform: translateY(-4px);
}

.template-card:hover .template-delete-btn {
    opacity: 1;
    transform: translateY(0);
}

.template-delete-btn:hover {
    background: rgba(239, 68, 68, var(--opacity-light));
    border-color: var(--color-error-50);
    box-shadow: var(--shadow-glow-error), var(--shadow-sm);
    transform: translateY(0) scale(1.05);
}

/* DEPRECATED - Removed overlay approach */
.template-info-overlay {
    display: none;
}

/* Compact Info Section - Separate from preview */
.template-info {
    padding: var(--space-md);
}

.template-name {
    font-size: var(--font-sm);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-meta {
    display: flex;
    gap: var(--space-md);
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    align-items: center;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    white-space: nowrap;
}

.meta-divider {
    color: var(--color-text-tertiary);
}

.platform-info {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    white-space: nowrap;
}

.platform-icon {
    font-size: var(--font-lg);
}

.platform-name {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
}

/* DEPRECATED - Old template category/platforms styles */
.template-category,
.template-platforms {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* DEPRECATED - Old bottom actions (replaced by .template-actions-top) */
.template-actions {
    display: none; /* Using top actions now */
    gap: var(--space-sm);
    padding: 0;
    background: transparent;
    border-top: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.template-card:hover .template-actions {
    opacity: 1;
    transform: translateY(0);
}

.template-actions button {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-xs);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all 0.3s;
}

/* Template card action buttons - Aliases for semantic naming */
/* TODO: Update Templates.js to use .btn .btn-* instead of these aliases */
.btn-view {
    /* Extends .btn .btn-glass from theme.css */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--color-glass-light);
    backdrop-filter: blur(10px);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-medium);
    box-shadow: var(--shadow-sm);
}

.btn-view:hover {
    background: var(--color-glass-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-edit {
    /* Extends .btn .btn-primary from theme.css */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 var(--space-xs) var(--space-md) var(--shadow-glow-primary);
}

.btn-edit:hover {
    transform: translateY(-3px);
    box-shadow: 0 var(--space-sm) var(--space-xl) var(--shadow-glow-primary);
}

.btn-copy {
    /* Extends .btn .btn-success from theme.css */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 var(--space-xs) var(--space-md) var(--shadow-glow-success);
}

.btn-copy:hover {
    transform: translateY(-3px);
    box-shadow: 0 var(--space-sm) var(--space-xl) var(--shadow-glow-success);
}

/* Forms */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--color-black);
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
}

.form-input {
    width: 100%;
    padding: var(--space-md) var(--space-md);
    background: var(--color-white);
    border: 1px solid var(--color-black);
    border-radius: var(--radius-xl);
    color: var(--color-black);
    font-size: var(--font-sm);
    transition: all 0.3s;
}

.form-input::placeholder {
    color: rgba(0, 0, 0, var(--opacity-strong));
}

.form-input:focus {
    outline: none;
    background: var(--color-white);
    border-color: var(--color-primary);
    border-width: var(--space-xs);
}

.form-text {
    display: block;
    margin-top: var(--space-xs);
    font-size: var(--font-xs);
    color: var(--color-text-tertiary);
}

.form-text-warning {
    display: block;
    margin-top: var(--space-xs);
    font-size: var(--font-xs);
    color: var(--color-warning);
}

.form-input-static {
    display: block;
    padding: var(--space-md) var(--space-md);
    background: var(--color-glass-subtle);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-xl);
    color: var(--color-text-secondary);
    font-size: var(--font-sm);
}

/* Buttons */
/* Button styles now defined in theme.css */
/* Use: .btn .btn-primary, .btn .btn-secondary, etc. */

/* Clients Section */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.client-card {
    background: var(--color-glass-subtle);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-2xl);
    padding: var(--space-lg);
    transition: all 0.3s;
}

.client-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 var(--space-md) var(--space-2xl) var(--shadow-glow-primary);
    border-color: rgba(102, 126, 234, var(--opacity-strong));
}

.client-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.client-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-2xl);
    font-weight: var(--font-bold);
    color: white;
    flex-shrink: 0;
}

.client-info {
    flex: 1;
    min-width: 0;
}

.client-name {
    margin: 0 0 var(--space-xs) 0;
    font-size: var(--font-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-id {
    margin: 0;
    font-size: var(--font-xs);
    color: var(--color-text-tertiary);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-card-stats {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-md) 0;
    margin-bottom: var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, var(--opacity-light));
    border-bottom: 1px solid var(--color-border-light);
}

.client-card-stats .stat {
    flex: 1;
    text-align: center;
}

.client-card-stats .stat-label {
    display: block;
    font-size: var(--font-xs);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    margin-bottom: var(--space-sm);
}

.client-card-stats .stat-value {
    display: block;
    font-size: var(--font-2xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
}

.client-card-actions {
    display: flex;
    gap: var(--space-md);
}

.client-card-actions .btn {
    flex: 1;
    justify-content: center;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
}

/* Override btn-outline for dark glassmorphic cards */
.client-card-actions .btn-outline {
    background: var(--color-glass-light);
    backdrop-filter: blur(10px);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-medium);
}

/* Template Preview Modal */
.template-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, var(--opacity-heavy));
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--space-2xl);
}

.template-preview-modal .template-preview-canvas {
    position: relative;
    border-radius: var(--radius-2xl);
    box-shadow: 0 var(--space-2xl) var(--space-4xl) rgba(0, 0, 0, var(--opacity-solid));
    border: 1px solid var(--color-border-medium);
}

.template-preview-close {
    position: absolute;
    top: var(--space-2xl);
    right: var(--space-2xl);
    width: 48px;
    height: 48px;
    background: var(--color-bg-elevated);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-full);
    color: var(--color-text-primary);
    font-size: var(--font-xl);
    font-weight: var(--font-bold);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10001;
}

.template-preview-close:hover {
    background: var(--color-error);
    transform: scale(1.1);
    box-shadow: 0 var(--space-sm) var(--space-xl) var(--shadow-glow-error);
}
