/* ========================================
   Master Data Maintenance - Professional UI
   SKF Corporate Theme
   ======================================== */

:root {
    --skf-blue: #005EB8;
    --skf-dark-blue: #003A70;
    --skf-light-blue: #E6F2FF;
    --skf-green: #28a745;
    --skf-orange: #FFA500;
    --skf-red: #dc3545;
    --skf-gray: #6c757d;
    --skf-light-gray: #f8f9fa;
    --skf-border: #dee2e6;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: var(--text-dark);
    line-height: 1.6;
}

/* ========================================
   NAVIGATION BAR
   ======================================== */
.navbar {
    background: linear-gradient(135deg, var(--skf-blue) 0%, var(--skf-dark-blue) 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-subtitle {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 300;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
}

.user-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: white;
    color: var(--skf-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.notification-badge {
    background-color: var(--skf-red);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 5px;
}

/* ========================================
   CONTAINERS & LAYOUT
   ======================================== */
.container {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 30px;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    color: var(--text-dark);
    font-size: 2.25rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.page-header p {
    color: var(--text-light);
    font-size: 1rem;
}

.breadcrumb {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--skf-blue);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ========================================
   CARDS
   ======================================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    overflow: hidden;
    border: 1px solid var(--skf-border);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--skf-blue) 0%, var(--skf-dark-blue) 100%);
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.card-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 20px;
}

.card-description {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.card-footer {
    padding: 15px 20px;
    background-color: var(--skf-light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--skf-border);
}

.permission-badges {
    display: flex;
    gap: 8px;
}

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-read {
    background-color: #e7f3ff;
    color: var(--skf-blue);
}

.badge-edit {
    background-color: #fff4e6;
    color: var(--skf-orange);
}

.badge-approve {
    background-color: #e8f5e9;
    color: var(--skf-green);
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--skf-blue);
    color: white;
}

.btn-primary:hover {
    background-color: var(--skf-dark-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-success {
    background-color: var(--skf-green);
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: var(--skf-red);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-secondary {
    background-color: var(--skf-gray);
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--skf-blue);
    color: var(--skf-blue);
}

.btn-outline:hover {
    background-color: var(--skf-blue);
    color: white;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   TABLES
   ======================================== */
.table-container {
    background-color: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-top: 20px;
}

.table-header {
    padding: 20px;
    background-color: var(--skf-light-gray);
    border-bottom: 2px solid var(--skf-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.table-actions {
    display: flex;
    gap: 10px;
}

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

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

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--skf-border);
}

.data-table th {
    background-color: var(--skf-light-gray);
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: var(--skf-light-blue);
}

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

.table-stats {
    padding: 15px 20px;
    background-color: var(--skf-light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--skf-border);
}

/* ========================================
   FORMS
   ======================================== */
.form-container {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-width: 800px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--skf-light-blue);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--skf-border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--skf-blue);
    box-shadow: 0 0 0 3px rgba(0, 94, 184, 0.1);
}

.form-group input:read-only {
    background-color: var(--skf-light-gray);
    cursor: not-allowed;
}

.form-group .help-text {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--skf-border);
}

/* ========================================
   ALERTS
   ======================================== */
.alert {
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background-color: var(--skf-light-blue);
    color: var(--skf-dark-blue);
    border: 1px solid #b8daff;
}

/* ========================================
   LOGIN PAGE
   ======================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--skf-blue) 0%, var(--skf-dark-blue) 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 50px;
    max-width: 450px;
    width: 100%;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    font-size: 2rem;
    color: var(--skf-blue);
    margin-bottom: 5px;
}

.login-logo p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.login-form .form-group {
    margin-bottom: 25px;
}

.login-form .btn {
    width: 100%;
    padding: 14px;
    font-size: 1.05rem;
}

/* ========================================
   APPROVAL PAGE
   ======================================== */
.approval-container {
    max-width: 900px;
    margin: 50px auto;
    padding: 0 20px;
}

.approval-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.approval-header {
    background: linear-gradient(135deg, var(--skf-blue) 0%, var(--skf-dark-blue) 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.approval-header h1 {
    font-size: 1.75rem;
    margin-bottom: 10px;
}

.approval-body {
    padding: 40px;
}

.info-table {
    width: 100%;
    margin-bottom: 30px;
}

.info-table tr {
    border-bottom: 1px solid var(--skf-border);
}

.info-table td {
    padding: 12px 0;
}

.info-table td:first-child {
    font-weight: 600;
    color: var(--text-dark);
    width: 180px;
}

.info-table td:last-child {
    color: var(--text-light);
}

.changes-section {
    margin: 30px 0;
    padding: 20px;
    background-color: var(--skf-light-gray);
    border-radius: 8px;
}

.changes-title {
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-dark);
}

.change-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--skf-border);
}

.change-item:last-child {
    border-bottom: none;
}

.change-field {
    font-weight: 600;
    color: var(--text-dark);
}

.change-old {
    color: var(--skf-red);
    text-decoration: line-through;
}

.change-new {
    color: var(--skf-green);
    font-weight: 600;
}

/* ========================================
   EMPTY STATES
   ======================================== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background-color: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--skf-border);
    margin-bottom: 20px;
}

.empty-state h3 {
    color: var(--text-dark);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: 30px;
}

/* ========================================
   FOOTER
   ======================================== */
footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    margin-top: 60px;
    border-top: 1px solid var(--skf-border);
    font-size: 0.9rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        height: auto;
        padding: 15px 20px;
    }

    .nav-links {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .table-actions {
        flex-direction: column;
    }

    .login-card {
        padding: 30px;
    }
}

/* ========================================
   UTILITIES
   ======================================== */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-10 {
    gap: 10px;
}

/* ========================================
   PERSONA SWITCHER
   ======================================== */
.persona-switcher {
    display: flex;
    align-items: center;
}

.persona-select {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* User info & logout */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-logout {
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    color: white;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.7);
}

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #003A70 0%, #005EB8 50%, #0078D4 100%);
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.login-header {
    margin-bottom: 32px;
}

.login-header .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #005EB8;
    margin-bottom: 8px;
}

.login-header h1 {
    font-size: 1.2rem;
    color: #1a1a2e;
    margin: 8px 0;
}

.login-header p {
    color: #6c757d;
    font-size: 0.9rem;
}

.btn-microsoft {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 32px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    color: #1a1a2e;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    width: 100%;
    justify-content: center;
}

.btn-microsoft:hover {
    border-color: #005EB8;
    box-shadow: 0 4px 12px rgba(0, 94, 184, 0.15);
}

.login-footer {
    margin-top: 24px;
    color: #999;
    font-size: 0.8rem;
}

/* Inline editing */
td.editable {
    cursor: pointer;
    position: relative;
}

td.editable:hover {
    background: #f0f7ff;
    outline: 2px solid #005EB8;
    outline-offset: -2px;
}

td.cell-modified {
    background: #fff3cd !important;
    font-weight: 600;
}

.inline-input {
    width: 100%;
    padding: 4px 6px;
    border: 2px solid #005EB8;
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
    box-sizing: border-box;
}

/* Batch action bar */
.batch-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a1a2e;
    color: white;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
}

.batch-bar-content {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: 900px;
    width: 100%;
    justify-content: space-between;
}

.batch-bar-actions {
    display: flex;
    gap: 12px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #dee2e6;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #dee2e6;
}

.csv-summary {
    padding: 16px 24px;
    font-weight: 600;
    color: #005EB8;
}

.csv-errors {
    padding: 8px 24px;
    color: #dc3545;
    font-size: 0.85rem;
}

.modal-content .table-wrapper {
    overflow: auto;
    flex: 1;
    padding: 0 24px;
}

/* Row highlighting */
.row-insert {
    background: #d4edda !important;
}

.row-update {
    background: #fff3cd !important;
}

/* Batch approval */
.batch-summary {
    background: #e8f4fd;
    border: 1px solid #b8daff;
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 20px;
    font-size: 1rem;
}

.approval-form {
    margin-top: 24px;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 8px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
}

.approval-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-danger:hover {
    background: #c82333;
}

.val-old { color: #dc3545; }
.val-new { color: #28a745; font-weight: 600; }

/* Header actions */
.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Tabs */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0;
}

.tab {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab:hover {
    color: #005EB8;
}

.tab.active {
    color: #005EB8;
    border-bottom-color: #005EB8;
}

/* Analysis panel */
.analysis-panel {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 24px;
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.analysis-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.analysis-header p {
    margin: 4px 0 0;
    color: #6c757d;
    font-size: 0.85rem;
}

.ai-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: #005EB8;
    font-weight: 500;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #dee2e6;
    border-top-color: #005EB8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.ai-result {
    border: 1px solid #e8f4fd;
    border-radius: 8px;
    overflow: hidden;
}

.ai-header {
    background: linear-gradient(135deg, #005EB8, #003A70);
    color: white;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.95rem;
}

.ai-content {
    padding: 20px;
    line-height: 1.7;
    font-size: 0.9rem;
    background: #f8fbff;
}

.analysis-stats {
    display: flex;
    gap: 16px;
    margin-top: 16px;
}

.stat-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px 20px;
    text-align: center;
    flex: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #005EB8;
}

.stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 4px;
}

.analysis-section {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
}

.analysis-section h3 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.analysis-section.ai-section {
    border-color: #b8daff;
    background: #f8fbff;
    overflow: hidden;
    padding: 0;
}

.suggestion-item {
    margin: 6px 0;
    padding: 8px 12px;
    background: #e8f5e9;
    border-radius: 4px;
    font-size: 0.9rem;
}

.quality-issue {
    margin: 4px 0;
    color: #856404;
    font-size: 0.85rem;
}

.ai-status {
    margin-top: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    color: #6c757d;
    font-size: 0.9rem;
}

.data-table.compact {
    font-size: 0.85rem;
}

.data-table.compact td, .data-table.compact th {
    padding: 6px 10px;
}
