/* =============================================================================
   Speak2Apps Design System - Custom CSS Variables
   ============================================================================= */

:root {
    /* Brand Colors - Gradient theme inspired by AI/automation */
    --s2a-primary: #0066cc;
    --s2a-primary-dark: #004c99;
    --s2a-primary-light: #3385db;
    --s2a-accent: #00d4aa;
    --s2a-accent-dark: #00b894;
    
    /* Gradients */
    --s2a-gradient-primary: linear-gradient(135deg, #0066cc 0%, #0099ff 100%);
    --s2a-gradient-accent: linear-gradient(135deg, #00d4aa 0%, #00b894 100%);
    --s2a-gradient-subtle: linear-gradient(135deg, rgba(0, 102, 204, 0.03) 0%, rgba(0, 212, 170, 0.03) 100%);
    
    /* Neutrals - Warmer grays */
    --s2a-gray-50: #fafbfc;
    --s2a-gray-100: #f4f6f8;
    --s2a-gray-200: #e8ecef;
    --s2a-gray-300: #d5dce3;
    --s2a-gray-600: #6b7785;
    --s2a-gray-700: #4a5562;
    --s2a-gray-900: #1a1f26;
    
    /* Shadows - Subtelne */
    --s2a-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --s2a-shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --s2a-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
    
    /* Border radius */
    --s2a-radius-sm: 6px;
    --s2a-radius-md: 10px;
    --s2a-radius-lg: 14px;
    --s2a-radius-xl: 20px;
    
    /* Transitions */
    --s2a-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Override Bootstrap variables */
    --bs-primary: #0066cc;
    --bs-primary-rgb: 0, 102, 204;
    --bs-link-color: #0066cc;
    --bs-link-hover-color: #004c99;
    --bs-border-radius: 10px;
    --bs-border-radius-sm: 6px;
    --bs-border-radius-lg: 14px;
    --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* =============================================================================
   Global Styles
   ============================================================================= */

html, body {
    font-family: var(--bs-body-font-family);
    color: var(--s2a-gray-900);
    background: var(--s2a-gray-50);
}

/* Subtelne animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--s2a-gradient-subtle);
    z-index: -1;
    opacity: 1;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

/* Links with underline animation */
a {
    color: var(--s2a-primary);
    text-decoration: none;
    position: relative;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--s2a-primary-dark);
}

a:not(.btn):not(.nav-link)::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--s2a-gradient-accent);
    transition: width 0.3s ease;
}

a:not(.btn):not(.nav-link):hover::after {
    width: 100%;
}

/* =============================================================================
   Buttons - BEZ podskakiwania, tylko shimmer effect
   ============================================================================= */

.btn {
    border-radius: var(--s2a-radius-sm);
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: var(--s2a-transition);
    position: relative;
    overflow: hidden;
}

/* Subtelny shimmer effect przy hover */
.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.6s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--s2a-gradient-primary);
    border: none;
    color: white;
    box-shadow: var(--s2a-shadow-sm);
}

.btn-primary:hover {
    /* BEZ transform - nie podskakuje */
    box-shadow: var(--s2a-shadow-md);
    opacity: 0.95;
}

.btn-primary:active {
    opacity: 0.9;
    box-shadow: var(--s2a-shadow-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* =============================================================================
   Form Controls - BEZ podskakiwania
   ============================================================================= */

.form-control, .form-select {
    border: 1px solid var(--s2a-gray-300);
    border-radius: var(--s2a-radius-sm);
    transition: var(--s2a-transition);
    background-color: white;
}

.form-control:focus, .form-select:focus {
    border-color: var(--s2a-primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
    outline: none;
}

.form-floating > label {
    color: var(--s2a-gray-600);
    transition: color 0.2s ease;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--s2a-primary);
}

/* =============================================================================
   Cards - BEZ podskakiwania, tylko subtelny shadow
   ============================================================================= */

.card, .login-card {
    background: white;
    border: none;
    border-radius: var(--s2a-radius-lg);
    box-shadow: var(--s2a-shadow-md);
    transition: box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Gradient border effect */
.card::before, .login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--s2a-gradient-accent);
}

.card:hover {
    /* BEZ transform - nie podskakuje */
    box-shadow: var(--s2a-shadow-lg);
}

/* =============================================================================
   Login/Auth Pages
   ============================================================================= */

.login-container {
    min-height: calc(100vh - 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    width: 100%;
    max-width: 480px;
    padding: 2.5rem;
}

/* Subtelna dekoracja w rogu */
.login-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: var(--s2a-gradient-subtle);
    border-radius: var(--s2a-radius-xl) 0 0 0;
    opacity: 0.5;
    z-index: 0;
}

.login-card > * {
    position: relative;
    z-index: 1;
}

/* Login divider */
.login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 2rem 0;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--s2a-gray-300), transparent);
}

.login-divider span {
    padding: 0 1rem;
    font-size: 0.875rem;
    color: var(--s2a-gray-600);
    font-weight: 500;
    background: white;
}

/* =============================================================================
   External Login Buttons - BEZ podskakiwania
   ============================================================================= */

.btn-external-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--s2a-radius-sm);
    transition: var(--s2a-transition);
    background: white;
}

.btn-external-login .btn-icon {
    flex-shrink: 0;
}

.btn-external-login.btn-google {
    border: 1.5px solid var(--s2a-gray-300);
    color: #3c4043;
}

.btn-external-login.btn-google:hover {
    background-color: #f8f9fa;
    border-color: var(--s2a-primary-light);
    box-shadow: var(--s2a-shadow-sm);
    /* BEZ transform */
}

.btn-external-login.btn-microsoft {
    border: 1.5px solid var(--s2a-gray-300);
    color: #5e5e5e;
}

.btn-external-login.btn-microsoft:hover {
    background-color: #f3f3f3;
    border-color: var(--s2a-primary-light);
    box-shadow: var(--s2a-shadow-sm);
    /* BEZ transform */
}

/* =============================================================================
   Alerts
   ============================================================================= */

.alert {
    border: none;
    border-left: 4px solid;
    border-radius: var(--s2a-radius-sm);
    box-shadow: var(--s2a-shadow-sm);
}

.alert-info {
    background: rgba(0, 102, 204, 0.05);
    border-left-color: var(--s2a-primary);
    color: var(--s2a-primary-dark);
}

.alert-success {
    background: rgba(0, 212, 170, 0.05);
    border-left-color: var(--s2a-accent);
    color: var(--s2a-accent-dark);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.05);
    border-left-color: #dc3545;
    color: #b02a37;
}

/* =============================================================================
   Navigation
   ============================================================================= */

.nav-link {
    position: relative;
    transition: var(--s2a-transition);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--s2a-gradient-accent);
    border-radius: 0 4px 4px 0;
}

/* =============================================================================
   Validation States
   ============================================================================= */

.valid.modified:not([type=checkbox]) {
    border-color: var(--s2a-accent);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1);
}

.invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.validation-message {
    color: #dc3545;
    font-size: 0.875rem;
}

/* =============================================================================
   Loading States
   ============================================================================= */

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--s2a-gray-200) 25%, var(--s2a-gray-100) 50%, var(--s2a-gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--s2a-radius-sm);
}

/* =============================================================================
   Error Boundary
   ============================================================================= */

.blazor-error-boundary {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    padding: 1.5rem 1.5rem 1.5rem 4rem;
    color: white;
    border-radius: var(--s2a-radius-sm);
    box-shadow: var(--s2a-shadow-lg);
    position: relative;
}

.blazor-error-boundary::before {
    content: '?';
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* =============================================================================
   Utility Classes
   ============================================================================= */

.text-gradient {
    background: var(--s2a-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.badge-gradient {
    background: var(--s2a-gradient-accent);
    color: white;
    padding: 0.35em 0.65em;
    border-radius: var(--s2a-radius-sm);
    font-weight: 500;
}

/* =============================================================================
   Animations - Subtelne
   ============================================================================= */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 576px) {
    .login-card {
        padding: 1.5rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.35rem; }
}

/* =============================================================================
   Dark mode support (optional)
   ============================================================================= */

@media (prefers-color-scheme: dark) {
    :root {
        --s2a-gray-50: #1a1f26;
        --s2a-gray-100: #252b33;
        --s2a-gray-900: #f4f6f8;
    }
    
    body {
        background: var(--s2a-gray-50);
        color: var(--s2a-gray-900);
    }
    
    .card, .login-card {
        background: var(--s2a-gray-100);
    }
}

/* =============================================================================
   Top Bar - User Menu
   ============================================================================= */

.top-row {
    background-color: white;
    border-bottom: 1px solid var(--s2a-gray-200, #e8ecef);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    height: 3.5rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-link {
    color: var(--s2a-gray-700, #4a5562);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
}

.user-link:hover {
    color: var(--s2a-primary, #0066cc);
}

.logout-btn {
    color: var(--s2a-gray-600, #6b7785);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--s2a-gray-300, #d5dce3);
    border-radius: var(--s2a-radius-sm, 6px);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.logout-btn:hover {
    color: var(--s2a-primary, #0066cc);
    border-color: var(--s2a-primary, #0066cc);
    background-color: rgba(0, 102, 204, 0.05);
    text-decoration: none;
}

.login-link {
    color: var(--s2a-primary, #0066cc);
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--s2a-primary, #0066cc);
    border-radius: var(--s2a-radius-sm, 6px);
    transition: all 0.2s ease;
}

.login-link:hover {
    background: var(--s2a-gradient-primary, linear-gradient(135deg, #0066cc 0%, #0099ff 100%));
    color: white;
    border-color: transparent;
}

/* Responsive - mobile */
@media (max-width: 640px) {
    .user-menu {
        gap: 0.5rem;
    }
    
    .user-link {
        font-size: 0.875rem;
    }
    
    /* Hide logout text on mobile, show only icon */
    .logout-text {
        display: none;
    }
    
    .logout-btn {
        padding: 0.375rem 0.5rem;
        min-width: 36px;
        justify-content: center;
    }
}

@media (min-width: 641px) {
    /* Show logout text on desktop */
    .logout-text {
        display: inline;
    }
}

/* =============================================================================
   QuickGrid - Custom Styling
   ============================================================================= */

.quickgrid {
    width: 100%;
    border-collapse: collapse !important;
}

.quickgrid thead {
    background: var(--s2a-gray-100, #f4f6f8);
}

.quickgrid th {
    padding: 1rem;
    font-weight: 600;
    font-size: 0.8125rem;
    text-align: left;
    color: var(--s2a-gray-700, #4a5562);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--s2a-gray-300, #d5dce3);
    line-height: 1.2;
}

.quickgrid th[aria-sort] {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.quickgrid th[aria-sort]:hover {
    background-color: var(--s2a-gray-200, #e8ecef);
}

.quickgrid tbody tr {
    border-bottom: 1px solid var(--s2a-gray-200, #e8ecef);
    transition: background-color 0.2s ease;
    line-height: 1.5;
}

.quickgrid tbody tr:hover {
    background-color: rgba(0, 102, 204, 0.03);
}

.quickgrid td {
    padding: 1rem;
    color: var(--s2a-gray-900, #1a1f26);
    vertical-align: middle;
    line-height: 1.5;
}

/* Paginator */
.paginator {
    display: flex;
    gap: 0.5rem;
}

.paginator button {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--s2a-gray-300, #d5dce3);
    border-radius: var(--s2a-radius-sm, 6px);
    background: white;
    color: var(--s2a-gray-700, #4a5562);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.paginator button:hover:not(:disabled) {
    border-color: var(--s2a-primary, #0066cc);
    color: var(--s2a-primary, #0066cc);
    background-color: rgba(0, 102, 204, 0.05);
}

.paginator button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Responsive QuickGrid */
@media (max-width: 768px) {
    .quickgrid {
        font-size: 0.875rem;
    }
    
    .quickgrid th,
    .quickgrid td {
        padding: 0.75rem 0.5rem;
    }
}

/* Page identity in top-row */
.top-row-page-id {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.top-row-page-icon {
    font-size: 0.85rem;
    color: var(--s2a-primary);
    opacity: 0.6;
}

.top-row-page-title {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--s2a-gray-600);
}