/* ===== Base & Reset ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    color: #1a1a2e;
    background: #f8f9fb;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Login Page ===== */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem;
    animation: bgShift 8s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0%   { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
    50% { background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%); }
    100% { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
}

.login-card {
    background: rgba(255, 255, 255, 0.97);
    border-radius: 16px;
    padding: 2.5rem 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.04),
        0 20px 50px rgba(0, 0, 0, 0.12);
    animation: cardSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Login Header ===== */
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.35rem;
    font-weight: 600;
    color: #1a1a2e;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.login-subtitle {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 400;
}

/* ===== Form ===== */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
    letter-spacing: 0.01em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    color: #9ca3af;
    pointer-events: none;
    transition: color 0.2s ease;
}

.input-wrapper input {
    width: 100%;
    padding: 0.7rem 0.85rem 0.7rem 2.6rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    color: #1a1a2e;
    background: #fafbfc;
    transition: all 0.2s ease;
    outline: none;
}

.input-wrapper input::placeholder {
    color: #9ca3af;
    font-weight: 300;
}

.input-wrapper input:focus {
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper input:focus + .input-icon {
    color: #667eea;
}

.input-wrapper:focus-within .input-icon {
    color: #667eea;
}

.input-wrapper input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Error Message ===== */
.error-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    font-size: 0.82rem;
    font-weight: 400;
    animation: shakeError 0.4s ease;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%  { transform: translateX(-6px); }
    40%  { transform: translateX(6px); }
    60%  { transform: translateX(-4px); }
    80%  { transform: translateX(4px); }
}

/* ===== Login Button ===== */
.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.01em;
    margin-top: 0.25rem;
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.btn-login:active:not(:disabled) {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ===== Spinner ===== */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== App Layout ===== */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #eef0f4;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1a1a2e;
}

.header-brand svg {
    color: #667eea;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 0 2rem;
    flex: 1;
}

.nav-link {
    color: #4b5563;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: #667eea;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -15px; /* adjust to border-bottom of header */
    left: 0;
    right: 0;
    height: 3px;
    background: #667eea;
    border-radius: 3px 3px 0 0;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-greeting {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #4b5563;
    font-weight: 400;
}

.user-greeting svg {
    color: #9ca3af;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: transparent;
    color: #6b7280;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    border-color: #dc2626;
    color: #dc2626;
    background: #fef2f2;
}

/* ===== App Content ===== */
.app-content {
    flex: 1;
    padding: 2rem;
}

/* ===== Home / Welcome ===== */
.home-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 56px - 4rem);
}

.welcome-card {
    text-align: center;
    padding: 3rem 2rem;
    animation: cardSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.welcome-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    color: #667eea;
    margin-bottom: 1.5rem;
}

.welcome-card h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.welcome-card p {
    color: #6b7280;
    font-size: 0.95rem;
}

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

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #667eea;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* ===== 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-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ===== Form Validation (Blazor) ===== */
.valid.modified:not([type=checkbox]) {
    outline: none;
}

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

.validation-message {
    color: #dc2626;
    font-size: 0.8rem;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .login-card {
        padding: 2rem 1.5rem 1.5rem;
        border-radius: 12px;
    }

    .app-header {
        padding: 0 1rem;
    }

    .header-user {
        gap: 0.5rem;
    }

    .user-greeting {
        display: none;
    }
}

/* ===== Custom Modal (Global) ===== */
.custom-modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.4) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
}

.custom-modal {
    background: white !important;
    border-radius: 12px !important;
    width: 100% !important;
    max-width: 500px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1) !important;
    display: block !important;
    position: relative !important;
    z-index: 10000 !important;
}

.custom-modal-lg {
    max-width: 600px !important;
}

.custom-modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 1.5rem !important;
    border-bottom: 1px solid #eef0f4 !important;
}

.custom-modal-header h2 {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
}

.custom-modal-body {
    padding: 1.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
}

.custom-modal-footer {
    padding: 1.5rem !important;
    border-top: 1px solid #eef0f4 !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 1rem !important;
}

/* ===== Users Page (Utilizatori) ===== */
.users-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.users-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a2e;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.filter-control {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    background: #fff;
}

.filter-control:focus {
    border-color: #667eea;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th, .users-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eef0f4;
}

.users-table th {
    font-weight: 600;
    color: #4b5563;
    background: #fafbfc;
}

.badge-admin { background: #fee2e2; color: #dc2626; }
.badge-manager { background: #fef3c7; color: #d97706; }
.badge-operator { background: #d1fae5; color: #059669; }

/* ===== Locations Page (Locatii) ===== */
.locatii-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.locatii-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.locatii-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a2e;
}

.locatii-table {
    width: 100%;
    border-collapse: collapse;
}

.locatii-table th, .locatii-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eef0f4;
}

.locatii-table th {
    font-weight: 600;
    color: #4b5563;
    background: #fafbfc;
}

.badge-active { background: #d1fae5; color: #059669; }
.badge-inactive { background: #fee2e2; color: #dc2626; }

/* ===== Common Shared Components ===== */
.btn-primary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-secondary {
    padding: 0.6rem 1.2rem;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #f9fafb;
}

.table-responsive {
    overflow-x: auto;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon.edit { color: #3b82f6; }
.btn-icon.edit:hover { background: #eff6ff; }

.btn-icon.delete { color: #ef4444; }
.btn-icon.delete:hover { background: #fef2f2; }

.btn-icon.reset { color: #f59e0b; }
.btn-icon.reset:hover { background: #fffbeb; }

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* ===== Reset Password Page ===== */
.reset-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 56px - 4rem);
}

.reset-card {
    background: white;
    border-radius: 12px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.reset-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    color: #667eea;
    margin-bottom: 1.5rem;
}

.reset-card h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #1a1a2e;
}

.reset-card p {
    color: #6b7280;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.reset-card .btn-primary {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 10px;
    background: #667eea;
    color: white;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.reset-card .btn-primary:hover:not(:disabled) {
    background: #5a67d8;
}

.reset-card .btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.reset-card .alert {
    padding: 1rem;
    border-radius: 8px;
    text-align: left;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.reset-card .alert-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.reset-card .alert-success {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    text-align: center;
}

