/* VeioMonitor Custom Blazor Integration Styles */

/* Material Design 3 CSS Variables */
:root {
  /* Primary Colors */
  --primary: 34 197 94; /* green-500 */
  --primary-foreground: 255 255 255;

  /* Secondary Colors */
  --secondary: 241 245 249; /* slate-100 */
  --secondary-foreground: 15 23 42; /* slate-900 */

  /* Destructive Colors */
  --destructive: 239 68 68; /* red-500 */
  --destructive-foreground: 255 255 255;

  /* Accent Colors */
  --accent: 241 245 249; /* slate-100 */
  --accent-foreground: 15 23 42; /* slate-900 */

  /* Background Colors */
  --background: 255 255 255;
  --foreground: 15 23 42; /* slate-900 */

  /* Ring Colors for Focus States */
  --ring: 34 197 94; /* green-500 */
  --ring-offset: 255 255 255;
}

/* Material Design 3 Color Classes */
.bg-primary { background-color: rgb(var(--primary)); }
.text-primary-foreground { color: rgb(var(--primary-foreground)); }
.hover\\:bg-primary\\/90:hover { background-color: rgb(var(--primary) / 0.9); }

.bg-secondary { background-color: rgb(var(--secondary)); }
.text-secondary-foreground { color: rgb(var(--secondary-foreground)); }
.hover\\:bg-secondary\\/80:hover { background-color: rgb(var(--secondary) / 0.8); }

.bg-destructive { background-color: rgb(var(--destructive)); }
.text-destructive-foreground { color: rgb(var(--destructive-foreground)); }
.hover\\:bg-destructive\\/90:hover { background-color: rgb(var(--destructive) / 0.9); }
.hover\\:bg-destructive\\/10:hover { background-color: rgb(var(--destructive) / 0.1); }
.hover\\:text-destructive:hover { color: rgb(var(--destructive)); }

.bg-accent { background-color: rgb(var(--accent)); }
.text-accent-foreground { color: rgb(var(--accent-foreground)); }
.hover\\:bg-accent:hover { background-color: rgb(var(--accent)); }
.hover\\:text-accent-foreground:hover { color: rgb(var(--accent-foreground)); }

.ring-ring { --tw-ring-color: rgb(var(--ring)); }
.ring-offset-background { --tw-ring-offset-color: rgb(var(--ring-offset)); }

/* Enhanced Telerik Button Styling - Client Template Inspired */
.k-button {
  /* Base styling matching client template */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  white-space: nowrap !important;
  border-radius: 0.375rem !important; /* rounded-md */
  font-size: 0.875rem !important; /* text-sm */
  font-weight: 500 !important; /* font-medium */
  transition: all 0.15s ease-in-out !important;
  cursor: pointer !important;
  text-decoration: none !important;

  /* Focus states */
  outline: 2px solid transparent !important;
  outline-offset: 2px !important;
}

.k-button:focus-visible {
  outline: 2px solid rgb(var(--ring)) !important;
  outline-offset: 2px !important;
}

.k-button:disabled {
  pointer-events: none !important;
  opacity: 0.5 !important;
}

/* Primary Button Variant */
.k-button-primary {
  background-color: rgb(var(--primary)) !important;
  color: rgb(var(--primary-foreground)) !important;
  border: 1px solid rgb(var(--primary)) !important;
}

.k-button-primary:hover:not(:disabled) {
  background-color: rgb(var(--primary) / 0.9) !important;
  border-color: rgb(var(--primary) / 0.9) !important;
}

/* Secondary Button Variant */
.k-button-secondary {
  background-color: rgb(var(--secondary)) !important;
  color: rgb(var(--secondary-foreground)) !important;
  border: 1px solid rgb(var(--secondary)) !important;
}

.k-button-secondary:hover:not(:disabled) {
  background-color: rgb(var(--secondary) / 0.8) !important;
  border-color: rgb(var(--secondary) / 0.8) !important;
}

/* Error/Destructive Button Variant */
.k-button-error {
  background-color: rgb(var(--destructive)) !important;
  color: rgb(var(--destructive-foreground)) !important;
  border: 1px solid rgb(var(--destructive)) !important;
}

.k-button-error:hover:not(:disabled) {
  background-color: rgb(var(--destructive) / 0.9) !important;
  border-color: rgb(var(--destructive) / 0.9) !important;
}

/* Button Sizes */
.k-button-sm {
  height: 2.25rem !important; /* h-9 */
  padding: 0 0.75rem !important; /* px-3 */
  border-radius: 0.375rem !important; /* rounded-md */
}

.k-button-lg {
  height: 2.75rem !important; /* h-11 */
  padding: 0 2rem !important; /* px-8 */
  border-radius: 0.375rem !important; /* rounded-md */
}

.k-button-icon {
  height: 2.5rem !important; /* h-10 */
  width: 2.5rem !important; /* w-10 */
  padding: 0 !important;
}

/* Icon styling within buttons */
.k-button .k-icon,
.k-button .k-svg-icon {
  width: 1rem !important; /* w-4 */
  height: 1rem !important; /* h-4 */
  flex-shrink: 0 !important;
}

/* Full width buttons */
.k-button.w-full {
  width: 100% !important;
}

/* Blazor Error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Blazor Loading */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--forest-500);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate3d(0, 0, 1, -90deg);
}

.loading-progress circle:last-child {
    stroke-dasharray: 0.05rem 50rem;
    animation: blazor-loading-progress 1s ease-in-out infinite;
}

@keyframes blazor-loading-progress {
    0% {
        stroke-dasharray: 0.05rem 50rem;
        transform: rotate3d(0, 0, 1, 0deg);
    }

    50% {
        stroke-dasharray: 17.35rem 50rem;
        transform: rotate3d(0, 0, 1, 90deg);
    }

    100% {
        stroke-dasharray: 0.05rem 50rem;
        transform: rotate3d(0, 0, 1, 360deg);
    }
}

/* Component Integration Styles */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
}

/* Telerik Integration */
.k-animation-container {
    z-index: 10000;
}

/* Navigation Active States for Blazor NavLink */
.nav-link.active {
    background-color: var(--salamander-500) !important;
    color: white !important;
}

/* Mobile Navigation Styles */
.space-y-2 > * + * {
    margin-top: 0.5rem;
}

.pt-4 {
    padding-top: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

/* Override default Blazor sidebar styles */
.sidebar {
    display: none;
}

.top-row {
    display: none;
}

/* Ensure proper layout flow */
.main-content {
    width: 100%;
}

.content {
    padding: 0;
}

/* Responsive utility classes for Blazor components */
@media (max-width: 767px) {
    .space-x-8 > * + * {
        margin-left: 0;
        margin-top: 1rem;
    }
}

/* Flag icons placeholder */
.flag-icon {
    width: 20px;
    height: 15px;
    background-color: #ccc;
    border-radius: 2px;
    display: inline-block;
}

/* Validation styles */
.validation-message {
    color: #dc3545;
    font-size: 0.875em;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-summary {
    color: #e50000;
}

/* Form styles */
.form-group {
    margin-bottom: 1rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: var(--forest-500);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(34, 197, 94, 0.25);
}

/* Modal and overlay fixes */
.modal-backdrop {
    z-index: 1040;
}

.modal {
    z-index: 1050;
}

/* DataGrid Template - React-inspired Design */
.k-grid {
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06) !important;
    background: white !important;
    overflow: hidden !important;
}

.k-grid-header {
    background: #f9fafb !important;
    border-bottom: 1px solid #e5e7eb !important;
}

.k-grid-header th {
    background: #f9fafb !important;
    border-right: 1px solid #e5e7eb !important;
    color: #374151 !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    padding: 12px 16px !important;
}

.k-grid-content tr {
    border-bottom: 1px solid #f3f4f6 !important;
    transition: background-color 0.15s ease-in-out !important;
}

.k-grid-content tr:hover {
    background: #f9fafb !important;
}

.k-grid-content td {
    padding: 12px 16px !important;
    border-right: 1px solid #f3f4f6 !important;
    color: #374151 !important;
    font-size: 0.875rem !important;
}

/* Action buttons in DataGrid */
.k-grid .k-button {
    border-radius: 6px !important;
    font-size: 0.75rem !important;
    padding: 4px 8px !important;
    margin: 0 2px !important;
    border: 1px solid #d1d5db !important;
    background: white !important;
    color: #374151 !important;
    transition: all 0.15s ease-in-out !important;
}

.k-grid .k-button:hover {
    background: #f3f4f6 !important;
    border-color: #9ca3af !important;
}

.k-grid .k-button.k-button-primary {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: white !important;
}

.k-grid .k-button.k-button-primary:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
}

.k-grid .k-button.k-button-error {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: white !important;
}

.k-grid .k-button.k-button-error:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
}

/* Ensure fonts load properly */
/* Google Fonts are loaded globally in tailwind.css */

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Roboto Condensed', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Performance optimizations */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--forest-500);
    outline-offset: 2px;
}

/* CRM Sidebar Hierarchical Navigation */
.nav-sub-section {
    margin: 0.5rem 0;
}

.nav-sub-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-sub-items {
    padding-left: 1rem;
}

.nav-sub-subitem {
    display: block;
    padding: 0.5rem 1rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    margin: 0.125rem 0;
    transition: all 0.2s ease;
}

.nav-sub-subitem:hover {
    background-color: #f3f4f6;
    color: #059669;
}

.nav-sub-subitem.active {
    background-color: #d1fae5;
    color: #047857;
    font-weight: 500;
}