/* ===================================
   ITIL2 - Material Design (Google Style)
   Inspired by Google's Material Design 3
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;600;700&family=Roboto:wght@300;400;500;700&display=swap');

:root {
    /* Primary Colors - Google Blue */
    --brand-primary: #1a73e8;
    --brand-secondary: #4285f4;
    --brand-accent: #1a73e8;
    --brand-background: #f8f9fa;
    --brand-surface: #ffffff;
    --brand-text: #202124;
    --brand-muted: #5f6368;
    --brand-border: #dadce0;

    /* Sidebar - Google Style */
    --sidebar-gradient-start: #ffffff;
    --sidebar-gradient-end: #ffffff;
    --sidebar-text: #5f6368;
    --sidebar-active-bg: #e8f0fe;
    --sidebar-active-text: #1a73e8;

    /* UI Elements */
    --surface-elevated: #ffffff;
    --surface-border: #dadce0;
    --button-surface: #f1f3f4;
    --button-border: #dadce0;
    --button-text: #202124;

    /* Status Colors - Google Palette */
    --color-success: #1e8e3e;
    --color-danger: #d93025;
    --color-warning: #f9ab00;
    --color-info: #1a73e8;

    /* Shadows - Google Style */
    --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --shadow-md: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 2px 6px 2px rgba(60, 64, 67, 0.15);
    --shadow-lg: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
    --shadow-xl: 0 2px 3px 0 rgba(60, 64, 67, 0.3), 0 6px 10px 4px rgba(60, 64, 67, 0.15);

    /* Border Radius - Google Style (more subtle) */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background: var(--brand-background);
    color: var(--brand-text);
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===================================
   Typography - Google Style
   =================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Google Sans', 'Roboto', -apple-system, sans-serif;
    font-weight: 500;
    color: var(--brand-text);
    letter-spacing: 0;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 2rem; font-weight: 400; }
h2 { font-size: 1.5rem; font-weight: 400; }
h3 { font-size: 1.25rem; font-weight: 500; }
h4 { font-size: 1.125rem; font-weight: 500; }
h5 { font-size: 1rem; font-weight: 500; }
h6 { font-size: 0.875rem; font-weight: 500; }

.text-white,
.text-white h1,
.text-white h2,
.text-white h3,
.text-white h4,
.text-white h5,
.text-white h6,
.text-white p,
.text-white small,
.text-white span,
.text-white .card-title,
.text-white .card-subtitle,
.text-white .card-text,
.card.text-white,
.card.text-white h1,
.card.text-white h2,
.card.text-white h3,
.card.text-white h4,
.card.text-white h5,
.card.text-white h6,
.card.text-white p,
.card.text-white small,
.card.text-white span,
.card.text-white .card-title,
.card.text-white .card-subtitle,
.card.text-white .card-body,
.card.text-white .card-body * {
    color: #ffffff !important;
}

.card-header.text-white,
.card-header.text-white h5,
.card-header.text-white h6,
.card-header.text-white span {
    color: #ffffff !important;
}

.text-muted {
    color: var(--brand-muted) !important;
}

/* ===================================
   Cards - Google Style
   =================================== */
.card {
    background: var(--brand-surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: none;
    color: var(--brand-text);
    transition: var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--surface-border);
    padding: 16px 24px;
    font-weight: 500;
    font-size: 16px;
    color: var(--brand-text);
}

.card-header.bg-primary {
    background: var(--brand-primary) !important;
    color: #ffffff;
    border-bottom: none;
}

.card-body {
    padding: 24px;
    background: var(--brand-surface);
    color: var(--brand-text);
}

/* ===================================
   Buttons - Google Style (Pill Shape)
   =================================== */
.btn {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 14px;
    padding: 10px 24px;
    border-radius: var(--radius-full);
    border: none;
    transition: var(--transition-base);
    box-shadow: none;
    letter-spacing: 0.1px;
}

.btn:hover {
    box-shadow: var(--shadow-sm);
}

.btn:active {
    box-shadow: none;
}

.btn-primary {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff !important;
}

.btn-primary:hover {
    background: #1557b0;
    border-color: #1557b0;
    color: #ffffff !important;
}

.btn-primary:focus,
.btn-primary:active {
    background: #1557b0;
    border-color: #1557b0;
    color: #ffffff !important;
    box-shadow: none;
}

.btn-success {
    background: var(--color-success);
    border-color: var(--color-success);
    color: #ffffff !important;
}

.btn-success:hover {
    background: #137333;
    border-color: #137333;
    color: #ffffff !important;
}

.btn-warning {
    background-color: var(--color-warning);
    border-color: var(--color-warning);
    color: #202124 !important;
}

.btn-danger {
    background-color: var(--color-danger);
    border-color: var(--color-danger);
    color: #ffffff !important;
}

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

.btn-info {
    background-color: var(--color-info);
    border-color: var(--color-info);
    color: #ffffff !important;
}

.btn-outline-primary {
    color: var(--brand-primary);
    border: 1px solid var(--surface-border);
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: #e8f0fe;
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.btn-secondary {
    background-color: #f1f3f4;
    border-color: #f1f3f4;
    color: var(--brand-text) !important;
}

.btn-secondary:hover {
    background-color: #e8eaed;
    border-color: #e8eaed;
    color: var(--brand-text) !important;
}

.btn-outline-secondary {
    color: var(--brand-muted);
    border: 1px solid var(--surface-border);
    background: transparent;
}

.btn-outline-secondary:hover {
    background-color: #f1f3f4;
    color: var(--brand-text);
    border-color: var(--surface-border);
}

.btn-sm {
    padding: 6px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 15px;
}

/* ===================================
   Forms - Google Style
   =================================== */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--surface-border);
    padding: 10px 16px;
    background: var(--brand-surface);
    color: var(--brand-text);
    font-size: 14px;
    transition: var(--transition-base);
    height: auto;
}

.form-control:hover, .form-select:hover {
    border-color: var(--brand-text);
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-primary);
    border-width: 2px;
    padding: 9px 15px;
    box-shadow: none;
    outline: none;
    background: var(--brand-surface);
}

.form-control::placeholder {
    color: var(--brand-muted);
    opacity: 1;
}

.form-label {
    font-weight: 500;
    font-size: 12px;
    color: var(--brand-muted);
    margin-bottom: 8px;
    letter-spacing: 0.4px;
}

.form-check-input {
    width: 18px;
    height: 18px;
    border: 2px solid var(--surface-border);
    border-radius: 2px;
    cursor: pointer;
    accent-color: var(--brand-primary);
}

.form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.form-check-input:focus {
    border-color: var(--brand-primary);
    box-shadow: none;
}

/* ===================================
   Badges - Google Style
   =================================== */
.badge {
    font-weight: 500;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    letter-spacing: 0;
    text-transform: none;
}

.bg-primary {
    background: #e8f0fe !important;
    color: var(--brand-primary) !important;
}

.bg-success {
    background: #ceead6 !important;
    color: var(--color-success) !important;
}

.bg-warning {
    background: #fef7e0 !important;
    color: #b06000 !important;
}

.bg-info {
    background: #e8f0fe !important;
    color: var(--brand-primary) !important;
}

.bg-danger {
    background: #fce8e6 !important;
    color: var(--color-danger) !important;
}

.bg-secondary {
    background: #e8eaed !important;
    color: var(--brand-muted) !important;
}

/* ===================================
   Tables - Google Style
   =================================== */
.table {
    font-size: 14px;
    color: var(--brand-text);
    border-collapse: collapse;
}

.table thead {
    background: #f8f9fa !important;
}

.table thead th {
    font-weight: 500;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--brand-muted) !important;
    background: #f8f9fa !important;
    border: none;
    border-bottom: 1px solid var(--surface-border);
    padding: 14px 16px;
    white-space: nowrap;
}

.table tbody tr {
    color: var(--brand-text);
    background: var(--brand-surface);
    border-bottom: 1px solid var(--surface-border);
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.table tbody td {
    padding: 14px 16px;
    border: none;
    vertical-align: middle;
}

/* ===================================
   List Groups - Google Style
   =================================== */
.list-group-item {
    background: var(--brand-surface);
    border: 1px solid var(--surface-border);
    border-radius: 0;
    margin-bottom: 0;
    padding: 14px 16px;
    transition: var(--transition-base);
    font-size: 14px;
}

.list-group-item:first-child {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.list-group-item:last-child {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.list-group-item:hover {
    background: #f8f9fa;
}

/* ===================================
   Alerts - Google Style
   =================================== */
.alert {
    border-radius: var(--radius-md);
    border: none;
    font-size: 14px;
    padding: 16px 20px;
    font-weight: 400;
}

.alert-info {
    background-color: #e8f0fe;
    color: var(--brand-primary);
}

.alert-success {
    background-color: #ceead6;
    color: var(--color-success);
}

.alert-warning {
    background-color: #fef7e0;
    color: #b06000;
}

.alert-danger {
    background-color: #fce8e6;
    color: var(--color-danger);
}

/* ===================================
   Modal - Google Style
   =================================== */
.modal-content {
    background: var(--brand-surface);
    color: var(--brand-text);
    border-radius: var(--radius-xl);
    border: none;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    background: transparent;
    color: var(--brand-text);
    border-bottom: none;
    padding: 24px 24px 16px;
}

.modal-header .modal-title {
    font-weight: 500;
    font-size: 24px;
}

.modal-body {
    background: var(--brand-surface);
    color: var(--brand-text);
    padding: 0 24px 24px;
}

.modal-footer {
    background: var(--brand-surface);
    border-top: none;
    padding: 16px 24px 24px;
    justify-content: flex-end;
    gap: 8px;
}

/* ===================================
   Sidebar Navigation - Google Style
   =================================== */
body.layout {
    display: flex;
    min-height: 100vh;
    background: var(--brand-background);
}

#sidebar {
    flex: 0 0 280px;
    width: 280px;
    min-height: 100vh;
    background: var(--brand-surface);
    color: var(--sidebar-text);
    border-right: 1px solid var(--surface-border);
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    gap: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 16px 12px;
    border-bottom: none;
    min-height: 64px;
    width: 100%;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-primary);
    color: #ffffff;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sidebar-text {
    flex: 1;
}

.sidebar-header h4 {
    font-weight: 500;
    font-size: 18px;
    margin: 0;
    color: var(--brand-text);
}

.sidebar-header p {
    font-size: 12px;
    color: var(--brand-muted);
    margin: 0;
}

#sidebar .nav {
    width: 100%;
    flex: 1;
    padding: 8px 0;
}

#sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--sidebar-text);
    border-radius: var(--radius-full);
    transition: var(--transition-base);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    margin-bottom: 2px;
}

#sidebar .nav-link i {
    width: 24px;
    font-size: 20px;
    text-align: center;
    flex-shrink: 0;
}

#sidebar .nav-link span {
    flex: 1;
}

#sidebar .nav-link:hover {
    background: #f1f3f4;
    color: var(--brand-text);
}

#sidebar .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 500;
}

#sidebar .nav-link.active::before {
    display: none;
}

.divider {
    height: 1px;
    background: var(--surface-border);
    margin: 8px 16px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--brand-muted);
    padding: 16px 16px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-content {
    flex: 1;
    padding: 24px;
    background: var(--brand-background);
    min-height: 100vh;
}

/* ===================================
   Topbar - Google Style
   =================================== */
.topbar {
    background: var(--brand-surface);
    border-bottom: 1px solid var(--surface-border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.topbar-brand-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.topbar-brand-logo img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.topbar-brand-text h4 {
    font-weight: 500;
    font-size: 18px;
    color: var(--brand-text);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8f0fe;
    color: var(--brand-primary);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--brand-text);
}

.user-role {
    font-size: 12px;
    color: var(--brand-muted);
}

/* ===================================
   Dropdown - Google Style
   =================================== */
.dropdown-menu {
    background: var(--brand-surface);
    color: var(--brand-text);
    border-radius: var(--radius-md);
    border: none;
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
    min-width: 200px;
}

.dropdown-item {
    padding: 10px 16px;
    color: var(--brand-text);
    font-size: 14px;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
}

.dropdown-item:hover {
    background: #f1f3f4;
    color: var(--brand-text);
}

.dropdown-item.text-danger {
    color: var(--color-danger);
}

.dropdown-item.text-danger:hover {
    background: #fce8e6;
}

.dropdown-divider {
    margin: 8px 0;
    border-color: var(--surface-border);
}

/* ===================================
   Progress Bar
   =================================== */
.progress {
    height: 4px;
    border-radius: var(--radius-full);
    background: #e8eaed;
    overflow: hidden;
}

.progress-bar {
    background: var(--brand-primary);
    transition: width 0.3s ease;
}

/* ===================================
   Scrollbar - Google Style
   =================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}

/* ===================================
   Spinner
   =================================== */
.spinner-border {
    border-color: #e8eaed;
    border-right-color: var(--brand-primary);
}

/* ===================================
   Dark Mode
   =================================== */
[data-theme="isp_dark"] {
    --brand-background: #1f1f1f;
    --brand-surface: #292929;
    --brand-text: #e8eaed;
    --brand-muted: #9aa0a6;
    --brand-border: #3c4043;
    --surface-border: #3c4043;
    --sidebar-text: #e8eaed;
    --sidebar-active-bg: rgba(138, 180, 248, 0.12);
    --sidebar-active-text: #8ab4f8;
}

[data-theme="isp_dark"] body {
    background: var(--brand-background);
    color: var(--brand-text);
}

[data-theme="isp_dark"] .card,
[data-theme="isp_dark"] .modal-content,
[data-theme="isp_dark"] .dropdown-menu {
    background: var(--brand-surface);
    border-color: var(--surface-border);
    color: var(--brand-text);
}

[data-theme="isp_dark"] .card-header {
    background: transparent;
    border-color: var(--surface-border);
    color: var(--brand-text);
}

[data-theme="isp_dark"] .btn-close {
    filter: invert(1);
}

[data-theme="isp_dark"] #sidebar {
    background: var(--brand-surface);
    border-color: var(--surface-border);
}

[data-theme="isp_dark"] .sidebar-header h4 {
    color: var(--brand-text);
}

[data-theme="isp_dark"] #sidebar .nav-link {
    color: var(--sidebar-text);
}

[data-theme="isp_dark"] #sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="isp_dark"] #sidebar .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

[data-theme="isp_dark"] .form-control,
[data-theme="isp_dark"] .form-select {
    background: #3c4043;
    border-color: #5f6368;
    color: var(--brand-text);
}

[data-theme="isp_dark"] .form-control:focus,
[data-theme="isp_dark"] .form-select:focus {
    background: #3c4043;
    border-color: #8ab4f8;
    color: var(--brand-text);
}

[data-theme="isp_dark"] .table {
    color: var(--brand-text);
}

[data-theme="isp_dark"] .table thead th {
    background: #3c4043 !important;
    color: var(--brand-muted) !important;
    border-color: var(--surface-border);
}

[data-theme="isp_dark"] .table tbody tr {
    background: var(--brand-surface);
    border-color: var(--surface-border);
}

[data-theme="isp_dark"] .table tbody tr:hover {
    background: #3c4043;
}

[data-theme="isp_dark"] .list-group-item {
    background: var(--brand-surface);
    border-color: var(--surface-border);
    color: var(--brand-text);
}

[data-theme="isp_dark"] .alert {
    color: var(--brand-text);
}

[data-theme="isp_dark"] h1,
[data-theme="isp_dark"] h2,
[data-theme="isp_dark"] h3,
[data-theme="isp_dark"] h4,
[data-theme="isp_dark"] h5,
[data-theme="isp_dark"] h6 {
    color: var(--brand-text);
}

[data-theme="isp_dark"] .dropdown-item {
    color: var(--brand-text);
}

[data-theme="isp_dark"] .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="isp_dark"] .topbar {
    background: var(--brand-surface);
    border-color: var(--surface-border);
}

/* ===================================
   Responsiveness
   =================================== */
@media (max-width: 1024px) {
    #sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
        z-index: 1000;
    }

    #sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }

    .card-body {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }
}

/* ===================================
   Utility Classes
   =================================== */
.text-primary { color: var(--brand-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: #b06000 !important; }

.hover-lift {
    transition: var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* SLA Status Alerts */
.sla-alert-violado {
    background-color: #fce8e6;
    color: var(--color-danger);
}

.sla-alert-critico {
    background-color: #fef7e0;
    color: #b06000;
}

.sla-alert-alerta {
    background-color: #fef7e0;
    color: #b06000;
}

.sla-alert-cumprido {
    background-color: #ceead6;
    color: var(--color-success);
}

.sla-alert-normal {
    background-color: #e8f0fe;
    color: var(--brand-primary);
}

/* Chat notification */
#chat-icon.has-unread::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--color-danger);
    border-radius: 50%;
    border: 2px solid var(--brand-surface);
}

/* Submenu */
.submenu {
    padding-left: 16px;
}

.submenu .nav-link {
    padding: 8px 16px;
    font-size: 13px;
}
