/* MTPL Unified Launcher - Main Stylesheet */

/* ===== CSS Variables ===== */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    --light-bg: #f8fafc;
    --dark-text: #1f2937;
    --light-text: #7f8c8d;
    --border-color: #e5e7eb;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 8px rgba(0,0,0,0.15);
}

/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: var(--light-bg);
}

/* ===== Header Styling (Packaging System Style) ===== */
header.sticky-top {
    z-index: 1040 !important;
    position: sticky !important;
    top: 0 !important;
}

.company-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.15);
    position: relative;
    z-index: 1040 !important;
}

.company-header .container-fluid {
    position: relative;
    z-index: 1041 !important;
}

.company-header .h4 {
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.logo-container {
    position: relative;
    z-index: 1042 !important;
}

.logo-stable {
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1042 !important;
}

.logo-stable:hover {
    transform: scale(1.05);
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Date and Time Container */
#currentTime,
#currentDate {
    position: relative;
    z-index: 1042 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Navigation Styling */
.navbar {
    background: #ffffff !important;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: auto !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

/* Ensure navbar items are vertically centered */
.navbar > .container-fluid {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.navbar .navbar-collapse {
    flex-grow: 1;
}

.navbar .navbar-collapse.show,
.navbar .navbar-collapse.collapsing {
    /* Mobile expanded state */
}

@media (min-width: 992px) {
    .navbar .navbar-collapse {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between;
    }
}

.navbar .navbar-nav {
    display: flex;
    align-items: center;
    margin-bottom: 0 !important; /* Override Bootstrap mb-2 */
    flex-wrap: nowrap;
}

.navbar .nav-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0.5rem;
    margin: 0 0.25rem;
    position: relative;
    overflow: hidden;
    font-weight: 500;
    color: #374151 !important;
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
}

.navbar .nav-link span {
    white-space: nowrap !important;
}

.navbar .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: left 0.6s;
}

.navbar .nav-link:hover::before {
    left: 100%;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(29, 78, 216, 0.1));
    color: #1d4ed8 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.navbar .dropdown-menu {
    border: none;
    background: #ffffff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    z-index: 1050 !important;
}

.dropdown-item {
    transition: all 0.2s ease;
    border-radius: 0.5rem;
    margin: 0.1rem 0.5rem;
    color: #374151;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white !important;
    transform: translateX(5px);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
}

/* User Dropdown Styling */
.company-header .dropdown-menu {
    min-width: 200px;
    z-index: 1050 !important;
}

.company-header .dropdown-item {
    padding: 0.5rem 1rem;
}

.company-header .dropdown-divider {
    margin: 0.25rem 0;
}

/* Main Container */
main {
    padding-top: 2rem;
    background: #f8fafc;
    position: relative;
    z-index: 1 !important;
}

main .container-fluid {
    position: relative;
    z-index: 1 !important;
}

/* Alert Styling */
.alert {
    border-radius: 0.5rem;
    border: none;
    margin-bottom: 1rem;
}

.alert i {
    font-size: 1rem;
}

/* Footer */
footer {
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
}

/* ===== Login Page ===== */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    padding: 2rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-box:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 35px 70px rgba(0, 0, 0, 0.3);
}

.logo-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin: 0 auto;
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-header h3 {
    color: var(--primary-color);
    margin-bottom: 5px;
    font-size: 1.5rem;
    font-weight: bold;
}

.login-header .subtitle,
.login-header .text-muted {
    color: var(--light-text);
    font-size: 14px;
}

.login-footer {
    margin-top: 1rem;
    text-align: center;
    color: var(--light-text);
    font-size: 12px;
}

/* Login Form Styling */
.form-label {
    font-weight: 600;
    color: var(--dark-text);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    display: block;
}

.input-group {
    margin-bottom: 0;
    display: flex;
    width: 100%;
}

.input-group-text {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-right: none;
    border-radius: 10px 0 0 10px;
    padding: 0.65rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-group .form-control {
    border: 2px solid #e0e0e0;
    border-left: none;
    border-radius: 0 10px 10px 0 !important;
    padding: 0.65rem 0.875rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    flex: 1;
}

.input-group:focus-within .input-group-text {
    border-color: #667eea;
}

.input-group:focus-within .form-control {
    border-color: #667eea;
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.15);
}

.btn-outline-secondary {
    border: 2px solid #e0e0e0;
    border-left: none;
    border-radius: 0 10px 10px 0;
    background: #f8f9fa;
    transition: all 0.3s ease;
    padding: 0.65rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-outline-secondary:hover {
    background-color: #e9ecef;
}

.btn-primary.btn-block {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.btn-primary.btn-block:hover:not(:disabled) {
    background: linear-gradient(45deg, #5a6fd8, #6a4190);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.form-text {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.text-muted {
    color: #6c757d;
}

.fw-semibold {
    font-weight: 600;
}

.text-dark {
    color: var(--dark-text);
}

.small {
    font-size: 0.875rem;
}

.mb-2 {
    margin-bottom: 0.75rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

/* Password input group fix */
.password-wrapper {
    position: relative;
}

.password-wrapper .input-group {
    width: 100%;
}

#togglePassword {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#togglePassword:hover {
    background-color: #e9ecef !important;
}

/* Form text helper */
.form-text.text-muted {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #6c757d;
}

/* ===== Navigation Bar ===== */
.navbar {
    background-color: var(--primary-color);
    color: white;
    padding: 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 0;
}

.navbar-logo {
    width: 40px;
    height: 40px;
}

.navbar-title {
    font-size: 18px;
    font-weight: bold;
    color: white;
}

.navbar-menu {
    display: flex;
    gap: 5px;
}

.navbar-item {
    color: white;
    text-decoration: none;
    padding: 20px 15px;
    display: block;
    transition: background-color 0.2s;
}

.navbar-item:hover {
    background-color: rgba(255,255,255,0.1);
}

.navbar-item.active {
    background-color: rgba(255,255,255,0.2);
    border-bottom: 3px solid var(--secondary-color);
}

.navbar-dropdown {
    position: relative;
}

.navbar-dropdown:hover .navbar-dropdown-menu {
    display: block;
}

.navbar-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border-radius: 0 0 5px 5px;
}

.navbar-dropdown-menu-right {
    left: auto;
    right: 0;
}

.navbar-dropdown-item {
    color: var(--dark-text);
    padding: 12px 20px;
    display: block;
    text-decoration: none;
    transition: background-color 0.2s;
}

.navbar-dropdown-item:hover {
    background-color: var(--light-bg);
}

.navbar-dropdown-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.navbar-dropdown-header strong {
    display: block;
    color: var(--dark-text);
}

.navbar-dropdown-header small {
    display: block;
    color: var(--light-text);
    font-size: 12px;
}

.navbar-user {
    display: flex;
    align-items: center;
}

.user-icon {
    font-size: 20px;
    margin-right: 8px;
}

.user-name {
    font-size: 14px;
}

/* ===== Container (Bootstrap Override) ===== */
.container-fluid {
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Bootstrap containers already handle max-width and margins */

/* ===== Alerts ===== */
.alerts-container {
    margin-bottom: 20px;
}

.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 15px;
    position: relative;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.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: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-close {
    position: absolute;
    right: 15px;
    top: 15px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--dark-text);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--light-text);
    font-size: 12px;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.form-control:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.checkbox-group {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 10px;
}

.checkbox-group label {
    display: block;
    padding: 5px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
}

/* ===== Buttons ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #7f8c8d;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* ===== Dashboard ===== */
.dashboard {
    padding: 20px 0;
}

.dashboard-header {
    margin-bottom: 30px;
}

.dashboard-header h1 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.dashboard-subtitle {
    color: var(--light-text);
}

.app-category {
    margin-bottom: 40px;
}

.category-title {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.app-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.app-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.app-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.app-icon-placeholder {
    width: 80px;
    height: 80px;
    background: var(--secondary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: bold;
    border-radius: 10px;
}

.app-name {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 18px;
}

.app-description {
    color: var(--light-text);
    font-size: 13px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--light-text);
}

/* ===== Admin Pages ===== */
.admin-page {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
    color: var(--primary-color);
}

.filters-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.filters-bar .form-control {
    flex: 1;
    max-width: 300px;
}

/* ===== Tables ===== */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 500;
    position: sticky;
    top: 0;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background-color: var(--light-bg);
}

.text-center {
    text-align: center;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--primary-color);
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--light-text);
}

.modal-close:hover {
    color: var(--dark-text);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== Settings Page ===== */
.settings-container {
    max-width: 1000px;
}

.settings-section {
    margin-bottom: 40px;
}

.settings-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 20px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.setting-item {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.info-item {
    padding: 15px;
    background-color: var(--light-bg);
    border-radius: 5px;
}

.info-item label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--light-text);
}

.info-item span {
    color: var(--dark-text);
}

/* ===== Error Page ===== */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--light-bg);
}

.error-container {
    text-align: center;
    padding: 40px;
}

.error-code {
    font-size: 120px;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.error-title {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.error-message {
    font-size: 18px;
    color: var(--light-text);
    margin-bottom: 30px;
}

.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* ===== Footer ===== */
.footer {
    background-color: var(--primary-color);
    color: white;
    padding: 20px 0;
    margin-top: 50px;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .navbar-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .navbar-menu {
        width: 100%;
        flex-direction: column;
    }
    
    .navbar-item {
        width: 100%;
    }
    
    .app-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-bar {
        flex-direction: column;
    }
    
    .filters-bar .form-control {
        max-width: none;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* ===== Modern Dashboard ===== */
.dashboard-modern {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-welcome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.welcome-content {
    flex: 1;
}

.welcome-title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: white;
}

.welcome-subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    color: rgba(255, 255, 255, 0.9);
}

.user-info-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-avatar {
    font-size: 3rem;
    color: white;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-name {
    font-weight: 600;
    font-size: 1rem;
    color: white;
}

.user-location {
    font-size: 0.875rem;
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.85);
}

.user-location i {
    margin-right: 0.25rem;
}

.apps-container {
    margin-top: 2rem;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.modern-app-card {
    background: white;
    border-radius: 16px;
    padding: 1.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
}

.modern-app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.modern-app-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.modern-app-card:hover::before {
    transform: scaleX(1);
}

.app-icon-wrapper {
    flex-shrink: 0;
}

.app-icon-modern {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.modern-app-card:hover .app-icon-modern {
    transform: scale(1.05);
}

.packaging-icon {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.document-icon {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

/* COMMENTED OUT - BARCODE GENERATOR NOT READY (December 2, 2025)
.barcode-icon {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}
*/

.default-icon {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
}

.app-content {
    flex: 1;
    min-width: 0;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.app-desc {
    font-size: 0.9rem;
    color: var(--light-text);
    line-height: 1.5;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.app-launch-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.125rem;
    transition: all 0.3s ease;
}

.modern-app-card:hover .app-launch-icon {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.empty-state-modern {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.empty-icon {
    font-size: 5rem;
    color: #d1d5db;
    margin-bottom: 1.5rem;
}

.empty-state-modern h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.empty-state-modern p {
    color: var(--light-text);
    font-size: 1rem;
    margin: 0.5rem 0;
}

/* Responsive for modern dashboard */
@media (max-width: 768px) {
    .dashboard-welcome {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .welcome-title {
        font-size: 1.5rem;
    }
    
    .welcome-subtitle {
        font-size: 1rem;
    }
    
    .apps-grid {
        grid-template-columns: 1fr;
    }
    
    .modern-app-card {
        padding: 1.5rem;
    }
}

/* ===== Dashboard Page (Packaging System Style) ===== */
.dashboard-page {
    padding: 1rem 2rem 2rem 2rem;
    background-color: #f8fafc;
    min-height: calc(100vh - 220px); /* Fill remaining viewport height minus header/footer */
    position: relative;
    z-index: 1 !important;
    display: flex;
    flex-direction: column;
}

/* Dashboard Header (Clean & Professional) */
.dashboard-header {
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
}

.dashboard-header .h3 {
    color: #3b82f6;
    font-weight: 700;
}

.dashboard-header .text-muted {
    color: #6b7280;
    font-size: 0.95rem;
}

/* Application Count Badge */
.app-count-badge {
    display: inline-flex;
    align-items: center;
    background: #f0f4f8;
    color: #334155;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.app-count-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background: #e8f0f7;
}

.app-count-badge i {
    font-size: 1.1rem;
    color: #64748b;
}

.app-count-badge .count-number {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0.625rem;
    line-height: 1;
    color: #1e293b;
}

.app-count-badge .count-label {
    font-size: 0.9rem;
    color: #475569;
    text-transform: capitalize;
}

/* Remove old page title section styles */
.page-title-section {
    display: none;
}

.page-title-icon,
.page-title-content,
.page-title,
.page-subtitle {
    /* Legacy styles - kept for compatibility */
}

/* Statistics Grid - Not used anymore but kept for compatibility */
.stats-grid {
    display: none;
}

/* Stat Cards - Legacy, hidden but kept for compatibility */
.stat-card {
    display: none;
}

/* Content Section */
.content-section {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    flex: 1; /* Take remaining space in dashboard-page */
    display: flex;
    flex-direction: column;
}

.content-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.section-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e9ecef;
    flex-shrink: 0; /* Don't shrink the header */
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title i {
    color: #667eea;
    font-size: 1.3rem;
}

.section-subtitle {
    font-size: 0.95rem;
    color: #7f8c8d;
    margin: 0;
}

/* Applications Grid */
.applications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    flex: 1; /* Take remaining space */
    align-content: center; /* Center grid items vertically */
}

.app-card-modern {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.app-card-modern:hover {
    border-color: #667eea;
    transform: translateY(-8px);
    box-shadow: 0 16px 32px rgba(102, 126, 234, 0.2);
}

.app-card-modern:active {
    transform: translateY(-6px);
}

/* New simplified card content */
.app-card-content {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 200px;
}

.app-icon-container {
    margin-bottom: 1.25rem;
}

.app-icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    color: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-card-modern:hover .app-icon-circle {
    transform: scale(1.15) rotate(8deg);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

.packaging-gradient {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.document-gradient {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

/* COMMENTED OUT - BARCODE GENERATOR NOT READY (December 2, 2025)
.barcode-gradient {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}
*/

.default-gradient {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
}

.app-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.75rem 0;
    line-height: 1.3;
}

.app-description {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

/* Hide old card sections */
.app-card-header,
.app-card-body,
.app-card-footer,
.app-status-badge,
.app-category,
.app-launch-btn {
    display: none;
}

.default-gradient {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
}

/* Empty State */
.empty-state-card {
    background: white;
    border-radius: 12px;
    padding: 4rem 2rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.empty-icon {
    font-size: 5rem;
    color: #d1d5db;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.75rem 0;
}

.empty-message {
    font-size: 1rem;
    color: #6b7280;
    margin: 0 0 0.5rem 0;
    line-height: 1.6;
}

.empty-submessage {
    font-size: 0.9rem;
    color: #9ca3af;
    margin: 0;
    line-height: 1.5;
}

/* Responsive Dashboard */
@media (max-width: 768px) {
    .dashboard-page {
        padding: 1rem;
        min-height: calc(100vh - 280px); /* Adjusted for mobile header */
    }
    
    .dashboard-header {
        padding: 1rem;
    }
    
    .dashboard-header .h3 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }
    
    .dashboard-header .text-muted {
        font-size: 0.875rem;
        display: block;
        margin-bottom: 0.75rem;
    }
    
    .app-count-badge {
        width: 100%;
        justify-content: center;
        padding: 1rem;
    }
    
    .app-count-badge .count-number {
        font-size: 1.5rem;
    }
    
    .content-section {
        padding: 1.5rem;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .section-subtitle {
        font-size: 0.875rem;
    }
    
    .applications-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1rem;
    }
    
    .app-card-content {
        padding: 1.5rem 1rem;
        min-height: 180px;
    }
    
    .app-icon-circle {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }
    
    .app-name {
        font-size: 1.1rem;
    }
    
    .app-description {
        font-size: 0.8rem;
    }
    
    .empty-state-card {
        padding: 3rem 1.5rem;
    }
    
    .empty-icon {
        font-size: 4rem;
    }
    
    .empty-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .dashboard-page {
        padding: 0.75rem;
    }
    
    .dashboard-header .h3 {
        font-size: 1.1rem;
    }
    
    .app-count-badge {
        padding: 0.875rem;
    }
    
    .app-count-badge .count-number {
        font-size: 1.35rem;
        margin: 0 0.4rem;
    }
    
    .app-count-badge .count-label {
        font-size: 0.8rem;
    }
    
    .content-section {
        padding: 1.25rem;
        border-radius: 8px;
    }
    
    .section-header {
        margin-bottom: 1.5rem;
    }
    
    .applications-grid {
        grid-template-columns: 1fr;
    }
    
    .app-card-content {
        min-height: 160px;
    }
}

/* ===============================================
   MASTER TABLE STYLING - Universal Table System
   =============================================== */

/* Master Table Container */
.master-table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    background: white;
}

/* Master Table Base */
.master-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: white;
}

/* Master Table Header */
.master-table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

.master-table thead th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 700;
    color: #495057;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.master-table thead th.text-center {
    text-align: center;
}

/* Master Table Body */
.master-table tbody tr {
    border-bottom: 1px solid #f1f3f5;
    transition: background-color 0.2s ease;
}

.master-table tbody tr:hover {
    background-color: #f8f9fa;
}

.master-table tbody tr:last-child {
    border-bottom: none;
}

.master-table tbody td {
    padding: 15px 12px;
    color: #495057;
    vertical-align: middle;
}

/* Empty State Styling */
.master-table .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.master-table .empty-state i {
    font-size: 64px;
    opacity: 0.3;
    margin-bottom: 20px;
    display: block;
    color: #adb5bd;
}

.master-table .empty-state h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #495057;
}

.master-table .empty-state p {
    font-size: 14px;
    color: #6c757d;
    margin: 0;
}

/* Loading State */
.master-table .loading-state {
    text-align: center;
    padding: 40px;
}

.master-table .loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* User Info Cell Styling */
.master-table .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.master-table .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.master-table .user-details {
    flex: 1;
    min-width: 0;
}

.master-table .user-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 15px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.master-table .user-email {
    font-size: 13px;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badge Styling */
.master-table .badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.master-table .status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-block;
}

.master-table .status-active {
    background: #d1e7dd;
    color: #0f5132;
}

.master-table .status-inactive {
    background: #f8d7da;
    color: #842029;
}

.master-table .badge-success {
    background: #d1e7dd;
    color: #0f5132;
}

.master-table .badge-danger {
    background: #f8d7da;
    color: #842029;
}

.master-table .badge-info {
    background: #cff4fc;
    color: #055160;
}

.master-table .badge-warning {
    background: #fff3cd;
    color: #856404;
}

.master-table .badge-primary {
    background: #cfe2ff;
    color: #084298;
}

.master-table .badge-secondary {
    background: #e2e3e5;
    color: #41464b;
}

/* Action Buttons */
.master-table .action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.master-table .btn-action {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.master-table .btn-edit {
    background: #0d6efd;
    color: white;
}

.master-table .btn-edit:hover {
    background: #0b5ed7;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.master-table .btn-delete {
    background: #dc3545;
    color: white;
}

.master-table .btn-delete:hover {
    background: #bb2d3b;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.master-table .btn-view {
    background: #6c757d;
    color: white;
}

.master-table .btn-view:hover {
    background: #5c636a;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

/* Toggle Switch Styling */
.master-table .toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    cursor: pointer;
}

.master-table .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.master-table .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.master-table .toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.master-table .toggle-switch input:checked + .toggle-slider {
    background-color: #27ae60;
}

.master-table .toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

/* Responsive Table */
@media (max-width: 768px) {
    .master-table-container {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .master-table thead th {
        padding: 12px 8px;
        font-size: 11px;
    }
    
    .master-table tbody td {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    .master-table .btn-action {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .master-table .action-buttons {
        gap: 5px;
    }
}

@media (max-width: 576px) {
    .master-table thead th {
        padding: 10px 6px;
        font-size: 10px;
    }
    
    .master-table tbody td {
        padding: 10px 6px;
        font-size: 12px;
    }
    
    .master-table .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* ===============================================
   MASTER MODAL FIELD STYLING - Universal Form System
   =============================================== */

/* Form Group - Standard spacing and structure */
.modal-form-group {
    margin-bottom: 20px;
}

.modal-form-group:last-child {
    margin-bottom: 0;
}

/* Form Labels */
.modal-form-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-form-label i {
    color: #6c757d;
    font-size: 13px;
}

.modal-form-label .required {
    color: #dc3545;
    margin-left: 2px;
}

/* Form Inputs */
.modal-form-input,
.modal-form-select,
.modal-form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
    color: #2c3e50;
}

.modal-form-input:focus,
.modal-form-select:focus,
.modal-form-textarea:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.modal-form-input::placeholder,
.modal-form-textarea::placeholder {
    color: #adb5bd;
}

.modal-form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Form Select Dropdown */
.modal-form-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
    appearance: none;
}

/* Checkbox Styling */
.modal-form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    cursor: pointer;
}

.modal-form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0d6efd;
}

.modal-form-checkbox label {
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    margin: 0;
    user-select: none;
}

/* Grid Layout for Forms */
.modal-form-grid {
    display: grid;
    gap: 20px;
}

.modal-form-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.modal-form-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.modal-form-full {
    grid-column: 1 / -1;
}

/* Form Help Text */
.modal-form-help {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-form-help i {
    font-size: 11px;
}

/* Error State */
.modal-form-input.error,
.modal-form-select.error,
.modal-form-textarea.error {
    border-color: #dc3545;
}

.modal-form-input.error:focus,
.modal-form-select.error:focus,
.modal-form-textarea.error:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.modal-form-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-form-error i {
    font-size: 11px;
}

/* Success State */
.modal-form-input.success,
.modal-form-select.success,
.modal-form-textarea.success {
    border-color: #27ae60;
}

/* Disabled State */
.modal-form-input:disabled,
.modal-form-select:disabled,
.modal-form-textarea:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Modal Buttons Container */
.modal-form-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.modal-btn-cancel {
    background: #6c757d;
    color: white;
}

.modal-btn-cancel:hover {
    background: #5c636a;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

.modal-btn-primary {
    background: #0d6efd;
    color: white;
}

.modal-btn-primary:hover {
    background: #0b5ed7;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

.modal-btn-success {
    background: #27ae60;
    color: white;
}

.modal-btn-success:hover {
    background: #229954;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.modal-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Responsive Modal Forms */
@media (max-width: 768px) {
    .modal-form-grid-2,
    .modal-form-grid-3 {
        grid-template-columns: 1fr;
    }
    
    .modal-form-buttons {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .modal-form-input,
    .modal-form-select,
    .modal-form-textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* ============================================================ */
/* MOBILE-FIRST RESPONSIVE ENHANCEMENTS (December 9, 2025) */
/* ============================================================ */
/* 
 * Comprehensive mobile support for phones and small tablets.
 * These styles enhance usability on touch devices without
 * affecting desktop/laptop layouts.
 */

/* Mobile Header - Company Header adjustments */
@media (max-width: 767.98px) {
    /* Reduce header padding on mobile */
    .company-header {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    /* Smaller logo on mobile */
    .company-header .logo-container img {
        height: 40px !important;
    }
    
    /* Adjust company name spacing */
    .company-header h1 {
        font-size: 1.1rem !important;
        margin-bottom: 0 !important;
    }
    
    /* Mobile user dropdown styling */
    .company-header .dropdown-menu {
        margin-top: 0.5rem !important;
        border-radius: 0.5rem;
    }
    
    /* Ensure touch-friendly dropdown items */
    .company-header .dropdown-item {
        padding: 0.75rem 1rem !important;
    }
}

/* Mobile Navigation */
@media (max-width: 991.98px) {
    /* Better touch targets for mobile menu items */
    .navbar .nav-link {
        min-height: 44px;
        display: flex !important;
        align-items: center !important;
        padding: 0.75rem 1rem !important;
    }
    
    /* Hamburger button styling */
    .navbar-toggler {
        padding: 0.5rem 0.75rem;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
    }
    
    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
    }
    
    /* Mobile menu container */
    .navbar-collapse {
        max-height: calc(100vh - 150px);
        overflow-y: auto;
        border-top: 1px solid #e5e7eb;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }
    
    /* Full width nav items on mobile */
    .navbar .nav-item {
        width: 100%;
    }
    
    /* Mobile dropdown menus */
    .navbar .dropdown-menu {
        width: 100% !important;
        position: static !important;
        background: #f8f9fa;
        border: none;
        padding: 0.5rem 0;
        box-shadow: none !important;
    }
    
    .navbar .dropdown-item {
        padding: 0.75rem 1.5rem !important;
    }
}

/* Very Small Mobile (phones in portrait) */
@media (max-width: 575.98px) {
    /* Compact container padding */
    .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* Smaller company header */
    .company-header .logo-container img {
        height: 35px !important;
    }
    
    .company-header h1 {
        font-size: 1rem !important;
    }
    
    .company-header .logo-container {
        margin-right: 0.5rem !important;
    }
    
    /* Card adjustments for mobile */
    .card {
        border-radius: 0.5rem;
    }
    
    .card-header,
    .card-body {
        padding: 0.75rem !important;
    }
    
    /* Application cards on dashboard */
    .app-card {
        padding: 1rem !important;
    }
    
    .app-card h5 {
        font-size: 1rem !important;
    }
    
    /* Buttons on mobile */
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .btn-sm {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
    }
    
    /* Form controls touch-friendly */
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px !important; /* Prevents iOS zoom */
    }
    
    /* Footer compact */
    footer {
        font-size: 0.75rem;
        padding: 0.5rem !important;
    }
}

/* Touch-friendly interactive elements */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .navbar .nav-link:hover {
        transform: none;
        box-shadow: none;
    }
    
    .app-card:hover {
        transform: none;
    }
    
    /* Larger touch targets */
    .btn,
    .nav-link,
    .dropdown-item,
    .form-control,
    .form-select {
        min-height: 44px;
    }
    
    /* Better active states for touch */
    .btn:active,
    .nav-link:active,
    .dropdown-item:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* Landscape mobile orientation */
@media (max-height: 500px) and (orientation: landscape) {
    /* Reduce header height in landscape */
    .company-header {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
    
    .company-header .logo-container img {
        height: 30px !important;
    }
    
    /* Smaller navbar */
    .navbar {
        padding: 0.25rem 0 !important;
    }
    
    /* Reduce main content padding */
    main {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
}

/* Print styles - hide mobile-only elements */
@media print {
    .d-md-none {
        display: none !important;
    }
}

/* ============================================================ */
/* COMPREHENSIVE MOBILE UI FIXES (December 13, 2025)           */
/* Unified Page (Launcher) - Extended Mobile Enhancements      */
/* ============================================================ */

/* ------------------------------------------------
   MOBILE APP CARDS GRID
   App cards should be touch-friendly and accessible
------------------------------------------------ */
@media (max-width: 767.98px) {
    /* App cards container */
    .app-grid,
    .row.row-cols-2.row-cols-md-3.row-cols-lg-4 {
        gap: 0.75rem !important;
    }
    
    /* App card sizing */
    .app-card {
        padding: 1rem !important;
        min-height: 120px;
    }
    
    .app-card .app-icon {
        font-size: 2rem !important;
        margin-bottom: 0.5rem;
    }
    
    .app-card .app-title {
        font-size: 0.85rem !important;
        line-height: 1.3;
    }
    
    .app-card .app-description {
        font-size: 0.75rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    /* App status badge */
    .app-card .status-badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Hover effects disabled on touch */
    .app-card:hover {
        transform: none;
    }
}

@media (max-width: 575.98px) {
    /* Single column on very small screens */
    .app-grid,
    .row.row-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    .row.row-cols-2 > * {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    .app-card {
        padding: 0.875rem !important;
        min-height: 100px;
    }
}

/* ------------------------------------------------
   MOBILE USER PROFILE DROPDOWN
------------------------------------------------ */
@media (max-width: 767.98px) {
    /* User dropdown */
    .user-dropdown .dropdown-menu {
        width: calc(100vw - 1rem) !important;
        max-width: 300px !important;
        right: 0.5rem !important;
        left: auto !important;
    }
    
    /* User info section */
    .user-dropdown .user-info {
        padding: 0.75rem !important;
    }
    
    .user-dropdown .user-name {
        font-size: 0.9rem;
    }
    
    .user-dropdown .user-role {
        font-size: 0.75rem;
    }
    
    /* Dropdown items */
    .user-dropdown .dropdown-item {
        padding: 0.625rem 1rem !important;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ------------------------------------------------
   MOBILE SYSTEM STATUS SECTION
------------------------------------------------ */
@media (max-width: 767.98px) {
    /* Status cards horizontal scroll */
    .system-status-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        gap: 0.75rem;
    }
    
    .system-status-row > * {
        flex: 0 0 auto !important;
        width: 160px !important;
        min-width: 160px !important;
    }
    
    /* Status card */
    .status-card {
        padding: 0.875rem !important;
    }
    
    .status-card .status-icon {
        font-size: 1.5rem !important;
    }
    
    .status-card .status-label {
        font-size: 0.75rem;
    }
    
    .status-card .status-value {
        font-size: 1rem;
    }
}

/* ------------------------------------------------
   MOBILE RECENT ACTIVITY SECTION
------------------------------------------------ */
@media (max-width: 767.98px) {
    /* Activity list */
    .activity-list {
        max-height: 400px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .activity-item {
        padding: 0.75rem !important;
        border-radius: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .activity-item .d-flex {
        flex-wrap: wrap;
    }
    
    .activity-item .activity-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .activity-item .activity-content {
        flex: 1;
        min-width: calc(100% - 50px);
    }
    
    .activity-item .activity-title {
        font-size: 0.85rem;
    }
    
    .activity-item .activity-time {
        font-size: 0.7rem;
        color: #6b7280;
    }
}

/* ------------------------------------------------
   MOBILE QUICK ACTIONS
------------------------------------------------ */
@media (max-width: 767.98px) {
    /* Quick action buttons */
    .quick-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .quick-actions .btn {
        flex: 1 1 calc(50% - 0.5rem);
        min-height: 50px;
        font-size: 0.8rem;
        padding: 0.625rem 0.75rem !important;
    }
    
    .quick-actions .btn i {
        display: block;
        margin-bottom: 0.25rem;
        font-size: 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .quick-actions .btn {
        flex: 1 1 100%;
    }
}

/* ------------------------------------------------
   MOBILE SETTINGS MODAL
------------------------------------------------ */
@media (max-width: 767.98px) {
    /* Settings modal full screen */
    #settingsModal .modal-dialog,
    #profileModal .modal-dialog {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
    }
    
    #settingsModal .modal-content,
    #profileModal .modal-content {
        border-radius: 0 !important;
        height: 100%;
    }
    
    /* Settings tabs vertical on mobile */
    #settingsModal .nav-tabs {
        flex-direction: row;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        border-bottom: 1px solid #e5e7eb;
    }
    
    #settingsModal .nav-tabs .nav-link {
        white-space: nowrap;
        padding: 0.625rem 1rem !important;
        font-size: 0.8rem;
        border-bottom: 2px solid transparent;
    }
    
    #settingsModal .nav-tabs .nav-link.active {
        border-bottom-color: var(--bs-primary);
    }
    
    /* Settings form */
    #settingsModal .form-group {
        margin-bottom: 1rem;
    }
    
    #settingsModal .form-control {
        font-size: 16px !important;
    }
}

/* ------------------------------------------------
   MOBILE NOTIFICATION CENTER
------------------------------------------------ */
@media (max-width: 767.98px) {
    /* Notification bell */
    .notification-bell {
        position: relative;
    }
    
    .notification-bell .badge {
        position: absolute;
        top: -5px;
        right: -5px;
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Notification panel */
    .notification-panel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        z-index: 1050;
    }
    
    .notification-panel .panel-header {
        padding: 1rem;
        border-bottom: 1px solid #e5e7eb;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .notification-panel .panel-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Notification item */
    .notification-panel .notification-item {
        padding: 0.875rem 1rem !important;
        border-bottom: 1px solid #f3f4f6;
    }
}

/* ------------------------------------------------
   MOBILE SEARCH BAR
------------------------------------------------ */
@media (max-width: 767.98px) {
    /* Search container */
    .search-container {
        width: 100% !important;
        padding: 0 0.5rem;
    }
    
    /* Search input */
    .search-input {
        width: 100% !important;
        font-size: 16px !important;
        padding: 0.75rem 1rem 0.75rem 2.5rem !important;
        border-radius: 2rem !important;
    }
    
    .search-icon {
        left: 1rem;
        font-size: 1rem;
    }
    
    /* Search results dropdown */
    .search-results {
        width: calc(100vw - 1rem) !important;
        max-width: calc(100vw - 1rem) !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
    }
    
    .search-result-item {
        padding: 0.75rem 1rem !important;
        min-height: 44px;
    }
}

/* ------------------------------------------------
   MOBILE FOOTER/COPYRIGHT
------------------------------------------------ */
@media (max-width: 767.98px) {
    footer,
    .footer {
        padding: 0.75rem 1rem !important;
        font-size: 0.75rem;
        text-align: center;
    }
    
    footer .d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    footer .footer-links {
        justify-content: center;
    }
    
    footer .footer-links a {
        padding: 0.25rem 0.5rem;
    }
}

/* ------------------------------------------------
   MOBILE LOADING STATES
------------------------------------------------ */
@media (max-width: 767.98px) {
    /* Loading spinner */
    .loading-overlay {
        position: fixed;
        inset: 0;
        background: rgba(255,255,255,0.9);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 9999;
    }
    
    .loading-spinner {
        width: 48px;
        height: 48px;
    }
    
    /* Skeleton loading */
    .skeleton {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: skeleton-loading 1.5s infinite;
    }
    
    @keyframes skeleton-loading {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
}

/* ------------------------------------------------
   MOBILE ERROR STATES
------------------------------------------------ */
@media (max-width: 767.98px) {
    /* Error page */
    .error-container {
        padding: 2rem 1rem !important;
        text-align: center;
    }
    
    .error-code {
        font-size: 4rem !important;
    }
    
    .error-message {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .error-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .error-actions .btn {
        width: 100%;
    }
}

/* ------------------------------------------------
   MOBILE TOAST NOTIFICATIONS
------------------------------------------------ */
@media (max-width: 767.98px) {
    /* Toast container */
    .toast-container {
        bottom: 1rem !important;
        right: 0.5rem !important;
        left: 0.5rem !important;
        width: auto !important;
    }
    
    .toast {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .toast-body {
        padding: 0.75rem 1rem !important;
        font-size: 0.85rem;
    }
}

/* ------------------------------------------------
   ENSURE ALL TOUCH TARGETS ARE ACCESSIBLE
------------------------------------------------ */
@media (hover: none) and (pointer: coarse) {
    /* Minimum touch target size */
    button,
    .btn,
    a.nav-link,
    a.dropdown-item,
    input[type="checkbox"],
    input[type="radio"],
    .form-check-input,
    .list-group-item-action,
    .app-card {
        min-height: 44px;
    }
    
    /* Checkbox/radio touch area */
    .form-check {
        padding: 0.5rem;
        margin: 0.25rem 0;
    }
    
    /* Remove hover effects on touch devices */
    .app-card:hover,
    .btn:hover {
        transform: none !important;
    }
    
    /* Active states instead */
    .app-card:active {
        transform: scale(0.98) !important;
        opacity: 0.9;
    }
}

/* ------------------------------------------------
   iOS SPECIFIC FIXES
------------------------------------------------ */
@supports (-webkit-touch-callout: none) {
    /* Prevent iOS zoom on input focus */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px !important;
    }
    
    /* iOS momentum scrolling everywhere */
    .modal-body,
    .dropdown-menu,
    .activity-list,
    .notification-panel .panel-body,
    .table-responsive,
    .search-results {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix iOS button styling */
    .btn,
    button {
        -webkit-appearance: none;
    }
    
    /* Fix iOS safe area (notch) */
    .company-header {
        padding-top: max(0.5rem, env(safe-area-inset-top)) !important;
    }
    
    footer {
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom)) !important;
    }
}