/* DASIA - Option 1 Master Theme Styles */

/* =============================================
   Card Shadows and Hover Effects
   ============================================= */
.card-shadow {
    box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.1);
}

.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px -8px rgba(0, 0, 0, 0.15);
}

/* =============================================
   DataTables Overrides for Tailwind
   ============================================= */
.dataTables_wrapper {
    font-size: 0.875rem;
}

.dataTables_wrapper .dataTables_length select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: #f9fafb;
}

.dataTables_wrapper .dataTables_length select:focus {
    outline: none;
    box-shadow: 0 0 0 2px #1A365D;
    border-color: #1A365D;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: #f9fafb;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    box-shadow: 0 0 0 2px #1A365D;
    border-color: #1A365D;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.375rem 0.875rem;
    margin: 0 0.125rem;
    border-radius: 0.5rem;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background-color: #f3f4f6;
    color: #1A365D;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background-color: #1A365D;
    color: white;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background-color: #153050;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #9ca3af;
    cursor: not-allowed;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background-color: transparent;
}

.dataTables_wrapper .dataTables_info {
    color: #6b7280;
    padding: 0.75rem 0;
}

/* =============================================
   Table Styling
   ============================================= */
table.dataTable {
    width: 100%;
    border-collapse: collapse;
}

table.dataTable thead th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

table.dataTable tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f3f4f6;
}

table.dataTable tbody tr:hover {
    background-color: #f9fafb;
}

/* =============================================
   Stat Cards - Option 1 Gradients
   ============================================= */
.stat-card {
    border-radius: 0.5rem;
    padding: 1.25rem;
    color: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px -8px rgba(0, 0, 0, 0.2);
}

/* Purple - Total Sites */
.stat-card.gradient-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* Green - Inspections */
.stat-card.gradient-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* Orange - Open Tasks */
.stat-card.gradient-orange {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

/* Red - Defects */
.stat-card.gradient-red {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
}

/* Legacy gradients for backwards compatibility */
.stat-card.gradient-primary {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.stat-card.gradient-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-card.gradient-warning {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.stat-card.gradient-danger {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* =============================================
   Button Styles
   ============================================= */
.btn-primary {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    box-shadow: 0 4px 12px -2px rgba(6, 182, 212, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #1A365D;
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #153050;
}

.btn-outline {
    border: 2px solid #1A365D;
    color: #1A365D;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background: #1A365D;
    color: white;
}

/* =============================================
   Menu & Navigation
   ============================================= */
.submenu-arrow.rotate-90 {
    transform: rotate(90deg);
}

/* =============================================
   Login Page
   ============================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('/static/img/background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* =============================================
   Form Styles
   ============================================= */
.form-input {
    padding: 0.625rem 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: #1A365D;
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}

/* =============================================
   Status Badges
   ============================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #cffafe;
    color: #0e7490;
}

.badge-gray {
    background-color: #f3f4f6;
    color: #374151;
}

/* =============================================
   Print Styles
   ============================================= */
@media print {
    #sidebar,
    nav,
    footer,
    .no-print {
        display: none !important;
    }

    #main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .card-shadow {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}

/* =============================================
   Scrollbar Styling
   ============================================= */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* =============================================
   Excel-like Datagrid Styles
   ============================================= */

/* Datagrid Container */
.datagrid-container {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    background: white;
}

/* Datagrid Toolbar */
.datagrid-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.datagrid-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.datagrid-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.datagrid-search {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0 0.75rem;
    min-width: 250px;
}

.datagrid-search input {
    border: none;
    outline: none;
    padding: 0.5rem 0.5rem;
    font-size: 0.8125rem;
    width: 100%;
    background: transparent;
}

.datagrid-search i {
    color: #9ca3af;
    font-size: 0.875rem;
}

.datagrid-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.15s ease;
    cursor: pointer;
    white-space: nowrap;
}

.datagrid-btn-default {
    background: white;
    border: 1px solid #e5e7eb;
    color: #4b5563;
}

.datagrid-btn-default:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.datagrid-btn-primary {
    background: #1A365D;
    border: 1px solid #1A365D;
    color: white;
}

.datagrid-btn-primary:hover {
    background: #153050;
}

.datagrid-btn i {
    margin-right: 0.375rem;
    font-size: 0.75rem;
}

/* Datagrid Scroll Wrapper */
.datagrid-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
}

/* Datagrid Table */
.datagrid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

/* Sticky Header */
.datagrid thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.datagrid thead th {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-top: none;
    padding: 0.5rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    text-align: left;
    white-space: nowrap;
    user-select: none;
}

.datagrid thead th:first-child {
    border-left: none;
}

.datagrid thead th:last-child {
    border-right: none;
}

/* Column Header Content */
.datagrid-th-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.datagrid-th-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.datagrid-th-icons {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.datagrid-th-icon {
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.15s ease;
}

.datagrid-th-icon:hover {
    background: #e2e8f0;
    color: #1A365D;
}

.datagrid-th-icon.active {
    color: #06b6d4;
}

/* Body Cells */
.datagrid tbody td {
    border: 1px solid #e5e7eb;
    padding: 0.375rem 0.625rem;
    color: #374151;
    vertical-align: middle;
}

.datagrid tbody td:first-child {
    border-left: none;
}

.datagrid tbody td:last-child {
    border-right: none;
}

/* Row Hover */
.datagrid tbody tr:hover td {
    background: #f0f9ff;
}

/* Selected Row */
.datagrid tbody tr.selected td {
    background: #e0f2fe;
}

/* Checkbox Column */
.datagrid-checkbox {
    width: 40px;
    text-align: center;
}

.datagrid-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1.5px solid #cbd5e1;
    cursor: pointer;
    accent-color: #1A365D;
}

/* Action Column */
.datagrid-actions {
    white-space: nowrap;
    text-align: center;
}

.datagrid-actions a,
.datagrid-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    color: #9ca3af;
    border-radius: 0.25rem;
    transition: all 0.15s ease;
}

.datagrid-actions a:hover,
.datagrid-actions button:hover {
    background: #f3f4f6;
}

.datagrid-actions .action-view:hover { color: #06b6d4; }
.datagrid-actions .action-edit:hover { color: #1A365D; }
.datagrid-actions .action-delete:hover { color: #ef4444; }

/* Cell Types */
.datagrid-cell-code {
    font-weight: 600;
    color: #1A365D;
}

.datagrid-cell-link {
    color: #1A365D;
    cursor: pointer;
}

.datagrid-cell-link:hover {
    color: #06b6d4;
    text-decoration: underline;
}

.datagrid-cell-number {
    text-align: right;
    font-family: ui-monospace, monospace;
}

.datagrid-cell-date {
    white-space: nowrap;
    color: #6b7280;
}

.datagrid-cell-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status Badge - Compact */
.datagrid-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.datagrid-badge-success { background: #d1fae5; color: #065f46; }
.datagrid-badge-warning { background: #fef3c7; color: #92400e; }
.datagrid-badge-danger { background: #fee2e2; color: #991b1b; }
.datagrid-badge-info { background: #cffafe; color: #0e7490; }
.datagrid-badge-gray { background: #f3f4f6; color: #374151; }

/* Footer / Info Bar */
.datagrid-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    font-size: 0.8125rem;
    color: #6b7280;
}

.datagrid-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.datagrid-selected-count {
    font-weight: 500;
    color: #1A365D;
}

/* Column Filter Dropdown */
.datagrid-filter-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    z-index: 50;
    display: none;
}

.datagrid-filter-dropdown.show {
    display: block;
}

.datagrid-filter-dropdown input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.8125rem;
    outline: none;
}

.datagrid-filter-options {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.375rem 0;
}

.datagrid-filter-option {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    cursor: pointer;
}

.datagrid-filter-option:hover {
    background: #f3f4f6;
}

.datagrid-filter-option input {
    margin-right: 0.5rem;
}

/* Column Visibility Dropdown */
.datagrid-columns-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 50;
    display: none;
    padding: 0.5rem 0;
}

.datagrid-columns-dropdown.show {
    display: block;
}

.datagrid-column-item {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    cursor: pointer;
}

.datagrid-column-item:hover {
    background: #f3f4f6;
}

.datagrid-column-item input {
    margin-right: 0.5rem;
}

/* Empty State */
.datagrid-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: #9ca3af;
}

.datagrid-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.datagrid-empty p {
    font-size: 0.875rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .datagrid-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .datagrid-toolbar-left,
    .datagrid-toolbar-right {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .datagrid-search {
        min-width: 100%;
    }
}

/* =============================================
   Role-Based Dashboard Styles
   ============================================= */

/* Page Header Themes */
.page-header-admin {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.page-header-vendor {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.page-header-pe {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* Role Badges */
.role-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 10px;
}

.role-vendor {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.role-inhouse {
    background-color: #ffedd5;
    color: #ea580c;
}

.role-pe {
    background-color: #f3e8ff;
    color: #7c3aed;
}

.role-system {
    background-color: #d1fae5;
    color: #059669;
}

/* Step Number Indicator */
.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    background: #e5e7eb;
    color: #374151;
}

.step-number.active {
    background: #3b82f6;
    color: white;
}

.step-number.completed {
    background: #10b981;
    color: white;
}

.step-number.pending {
    background: #f59e0b;
    color: white;
}

.step-number.danger {
    background: #ef4444;
    color: white;
}

.step-number.my-action {
    background: #ef4444;
    color: white;
    animation: pulse-action 2s infinite;
}

@keyframes pulse-action {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Alert Items */
.alert-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alert-item:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.alert-item.urgent {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.alert-item.warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.alert-item.info {
    border-left-color: #3b82f6;
    background: #eff6ff;
}

.alert-item.success {
    border-left-color: #10b981;
    background: #ecfdf5;
}

/* Time Badges */
.time-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.time-badge.ok {
    background: #d1fae5;
    color: #059669;
}

.time-badge.warn {
    background: #fef3c7;
    color: #d97706;
}

.time-badge.danger {
    background: #fee2e2;
    color: #dc2626;
}

/* Quick Filters */
.quick-filter {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    background: #f3f4f6;
    font-size: 0.75rem;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-filter:hover {
    background: #e5e7eb;
}

.quick-filter.active {
    background: #3b82f6;
    color: white;
}

/* Needs Action Row Highlight */
.needs-action {
    background-color: #fef3c7 !important;
}

.needs-action:hover {
    background-color: #fde68a !important;
}

/* Pulse Animation for Action Indicators */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
