/*
 * Smardoo SaaS Dashboard Stylesheet
 * Equips the profile, forwarding (routing), and card management pages with a premium visual design.
 */

:root {
    --sm-primary: #2563eb;
    --sm-primary-rgb: 37, 99, 235;
    --sm-primary-light: #3b82f6;
    --sm-primary-dark: #1d4ed8;
    --sm-accent: #3b82f6;
    --sm-accent-light: #60a5fa;
    --sm-text-dark: #1f2937;
    --sm-text-light: #6b7280;
    --sm-bg-cream: #f9fafb;
    --sm-bg-white: #FFFFFF;
    --sm-border: #e5e7eb;
    --sm-border-light: #f3f4f6;
    --sm-shadow: 0 4px 20px rgba(var(--sm-primary-rgb), 0.05);
    --sm-shadow-hover: 0 10px 30px rgba(var(--sm-primary-rgb), 0.1);
    --sm-radius-sm: 8px;
    --sm-radius-md: 12px;
    --sm-radius-lg: 16px;
    --sm-radius-full: 9999px;
    --sm-transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 1. Global Container & Layout */
.sm-management-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--sm-text-dark);
}

/* 2. Premium Card Styles */
.sm-card {
    background: var(--sm-bg-white);
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius-lg);
    padding: 2.5rem;
    box-shadow: var(--sm-shadow);
    transition: var(--sm-transition);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.sm-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--sm-primary) 0%, var(--sm-accent) 100%);
    opacity: 0.8;
}

.sm-card:hover {
    box-shadow: var(--sm-shadow-hover);
    transform: translateY(-2px);
    border-color: rgba(var(--sm-primary-rgb), 0.2);
}

.sm-card-header {
    border-bottom: 1px solid var(--sm-border);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.sm-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--sm-text-dark);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}

.sm-card-subtitle {
    font-size: 0.95rem;
    color: var(--sm-text-light);
    margin: 0;
    line-height: 1.4;
}

/* 3. Form Controls & Inputs */
.sm-form {
    width: 100%;
}

.sm-form-group {
    margin-bottom: 1.75rem;
    display: flex;
    flex-direction: column;
}

.sm-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--sm-text-dark);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.sm-label .required {
    color: var(--color-error, #ef4444);
    font-size: 1rem;
}

.sm-input, 
.sm-textarea, 
.sm-select {
    width: 100%;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius-sm);
    font-size: 0.95rem;
    background-color: var(--sm-bg-white);
    color: var(--sm-text-dark);
    transition: var(--sm-transition);
    box-sizing: border-box;
}

.sm-input:hover, 
.sm-textarea:hover, 
.sm-select:hover {
    border-color: var(--sm-primary-light);
}

.sm-input:focus, 
.sm-textarea:focus, 
.sm-select:focus {
    outline: none;
    border-color: var(--sm-primary);
    box-shadow: 0 0 0 4px rgba(var(--sm-primary-rgb), 0.12);
    background-color: var(--sm-bg-white);
}

.sm-textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* 4. Radio Grid & Custom Checkboxes */
.sm-grid {
    display: grid;
    gap: 1rem;
}

.sm-form-group .sm-grid label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--sm-bg-cream);
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--sm-transition);
    user-select: none;
}

.sm-form-group .sm-grid label:hover {
    border-color: var(--sm-primary-light);
    background: var(--sm-bg-white);
}

.sm-form-group .sm-grid label input[type="radio"],
.sm-form-group .sm-grid label input[type="checkbox"],
.sm-form-group label input[type="checkbox"] {
    accent-color: var(--sm-primary);
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

/* Active forwarding type radio indicator */
.sm-form-group .sm-grid label:has(input:checked) {
    background: var(--sm-bg-white);
    border-color: var(--sm-primary);
    box-shadow: 0 0 0 3px rgba(var(--sm-primary-rgb), 0.08);
    color: var(--sm-primary);
}

/* 5. Buttons */
.sm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.85rem 2rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: var(--sm-radius-full);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--sm-transition);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.sm-btn-primary {
    background: linear-gradient(135deg, var(--sm-primary) 0%, var(--sm-primary-light) 100%);
    color: var(--sm-bg-white) !important;
    box-shadow: 0 6px 16px rgba(var(--sm-primary-rgb), 0.15);
}

.sm-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(var(--sm-primary-rgb), 0.25);
    background: linear-gradient(135deg, var(--sm-primary-dark) 0%, var(--sm-primary) 100%);
}

.sm-btn-secondary {
    background: var(--sm-bg-white);
    color: var(--sm-primary) !important;
    border-color: var(--sm-primary);
}

.sm-btn-secondary:hover {
    background: rgba(var(--sm-primary-rgb), 0.04);
    transform: translateY(-2px);
}

/* 6. Alerts & Notices */
.sm-alert {
    padding: 1rem 1.5rem;
    border-radius: var(--sm-radius-sm);
    margin-bottom: 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: smFadeIn 0.3s ease;
}

.sm-alert-success {
    background-color: #EAF5EC;
    border: 1px solid #C2E2C9;
    color: var(--sm-primary);
}

.sm-alert-error {
    background-color: #FDF2F2;
    border: 1px solid #FCA5A5;
    color: var(--color-error, #ef4444);
}

@keyframes smFadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 7. Image & File Upload Dashboard Specifics */
.tapnfc-profile-field-avatar, 
.tapnfc-profile-field-cover {
    background: var(--sm-bg-cream);
    border: 1px dashed var(--sm-border);
    border-radius: var(--sm-radius-md);
    padding: 1.5rem;
    text-align: center;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.tapnfc-profile-field-avatar img {
    width: 100px;
    height: 100px;
    border-radius: var(--sm-radius-full);
    object-fit: cover;
    border: 3px solid var(--sm-bg-white);
    box-shadow: var(--sm-shadow);
    margin-bottom: 1rem;
}

/* File selector customization */
.sm-form input[type="file"] {
    background: var(--sm-bg-white);
    padding: 0.75rem;
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius-sm);
    width: 100%;
}

/* 8. Table Styling for Analytics/Subscribers */
.sm-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--sm-radius-md);
    border: 1px solid var(--sm-border);
    background: var(--sm-bg-white);
    margin-bottom: 2rem;
}

.sm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.sm-table th {
    background-color: var(--sm-bg-cream);
    color: var(--sm-text-dark);
    font-weight: 700;
    padding: 1rem 1.25rem;
    border-bottom: 2px solid var(--sm-border);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.sm-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--sm-border);
    color: var(--sm-text-light);
}

.sm-table tr:last-child td {
    border-bottom: none;
}

.sm-table tr:hover td {
    background-color: rgba(var(--sm-primary-rgb), 0.02);
    color: var(--sm-text-dark);
}

/* 9. Direct Routing (Forwarding) Enhancements */
.f-section {
    animation: smSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: top;
    margin-top: 1rem;
}

@keyframes smSlideDown {
    from { opacity: 0; transform: scaleY(0.9) translateY(-10px); }
    to { opacity: 1; transform: scaleY(1) translateY(0); }
}

.tapnfc-forwarding #current-file-info {
    background: var(--sm-bg-cream);
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius-sm);
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tapnfc-forwarding #current-file-info a {
    color: var(--sm-primary);
    font-weight: 700;
    text-decoration: underline;
}

/* 10. Card Management (Cards Dashboard) */
.tapnfc-cards-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.tapnfc-card-item {
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-radius-md);
    background: var(--sm-bg-white);
    padding: 1.5rem;
    box-shadow: var(--sm-shadow);
    transition: var(--sm-transition);
    display: flex;
    flex-direction: column;
}

.tapnfc-card-item:hover {
    border-color: var(--sm-accent);
    transform: translateY(-2px);
}

.tapnfc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tapnfc-card-badge {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--sm-radius-full);
}

.tapnfc-card-badge--active {
    background-color: #EAF5EC;
    color: var(--sm-primary);
}

.tapnfc-card-badge--inactive {
    background-color: #FDF2F2;
    color: var(--color-error);
}

.tapnfc-card-number {
    font-family: var(--font-mono, monospace);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .sm-card {
        padding: 1.5rem;
    }
    
    .sm-card-title {
        font-size: 1.35rem;
    }
    
    .sm-btn {
        width: 100%;
    }
}

/* My Account area: management screens fill the account content panel instead
   of a centred 900px column (public pages keep the centred layout). */
.woocommerce-MyAccount-content .sm-management-container {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}
