/**
 * Delivery Manager - Responsive CSS
 * Modern UI/UX with mobile-first approach
 */

/* ========================================
   Global Styles & Reset
   ======================================== */
* {
    box-sizing: border-box;
}

body.dm-frontend {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f9fafb;
    margin: 0;
    padding: 0;
}

/* ========================================
   Header Styles
   ======================================== */
.dm-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.dm-header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.dm-header-phone {
    display: flex;
    align-items: center;
    color: white;
}

.dm-header-phone svg {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

.dm-header-phone a {
    font-size: 16px;
    font-weight: 600;
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.dm-header-phone a:hover {
    opacity: 0.8;
}

.dm-header-logo img {
    height: 50px;
    width: auto;
    filter: brightness(0) invert(1);
}

.dm-header-brand {
    background: white;
    padding: 8px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dm-header-brand h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   Sidebar Styles
   ======================================== */
.dm-sidebar {
    position: fixed;
    left: 0;
    top: 75px;
    width: 250px;
    height: calc(100vh - 165px);
    background: #1f2937;
    color: white;
    padding: 20px;
    overflow-y: auto;
    z-index: 999;
    transition: transform 0.3s ease;
}

.dm-sidebar-header h2 {
    margin: 0 0 5px 0;
    font-size: 18px;
}

.dm-sidebar-header p {
    margin: 0 0 25px 0;
    font-size: 13px;
    color: #9ca3af;
}

.dm-sidebar nav a {
    display: block;
    padding: 12px 15px;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 5px;
    transition: all 0.3s;
}

.dm-sidebar nav a:hover {
    background: #374151;
    transform: translateX(5px);
}

.dm-sidebar nav a.active {
    background: #374151;
}

.dm-sidebar-logout {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #374151;
}

.dm-sidebar-logout a {
    color: #ef4444 !important;
}

.dm-sidebar-logout a:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ========================================
   Main Content Area
   ======================================== */
.dm-page-wrapper {
    position: relative;
    padding-top: 75px;
    padding-bottom: 90px;
    min-height: 100vh;
    background: #f3f4f6;
    width: 100%;
}

.dm-dashboard-content,
.dm-client-content {
    margin-left: 250px;
    padding: 30px;
    width: calc(100% - 250px);
    box-sizing: border-box;
    min-height: calc(100vh - 200px);
}

.dm-dashboard-content h1,
.dm-client-content h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 20px 0;
}

/* Override inline styles on mobile */
@media (max-width: 768px) {
    [style*="margin-left: 250px"] {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* ========================================
   Cards & Stat Boxes
   ======================================== */
.dm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.dm-stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-left: 4px solid;
    transition: transform 0.3s, box-shadow 0.3s;
}

.dm-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.dm-stat-card h3 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dm-stat-card p {
    margin: 0;
    font-size: 36px;
    font-weight: 700;
}

/* ========================================
   Tables
   ======================================== */
.dm-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin: 20px 0;
}

.dm-table {
    width: 100%;
    border-collapse: collapse;
}

.dm-table thead {
    background: #f9fafb;
}

.dm-table thead th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dm-table tbody td {
    padding: 15px;
    border-top: 1px solid #e5e7eb;
}

.dm-table tbody tr:hover {
    background: #f9fafb;
}

/* ========================================
   Buttons
   ======================================== */
.dm-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.dm-btn-primary {
    background: #2563eb;
    color: white;
}

.dm-btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.dm-btn-secondary {
    background: #6b7280;
    color: white;
}

.dm-btn-secondary:hover {
    background: #4b5563;
}

.dm-btn-success {
    background: #10b981;
    color: white;
}

.dm-btn-success:hover {
    background: #059669;
}

/* ========================================
   Forms
   ======================================== */
.dm-form-group {
    margin-bottom: 20px;
}

.dm-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.dm-form-input,
.dm-form-select,
.dm-form-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.dm-form-input:focus,
.dm-form-select:focus,
.dm-form-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dm-form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* ========================================
   Alerts & Notifications
   ======================================== */
.dm-alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 15px 0;
}

.dm-alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.dm-alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.dm-alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* ========================================
   Footer Styles
   ======================================== */
.dm-footer {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: white;
    padding: 30px 0;
    margin-top: auto;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.dm-footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.dm-footer-line {
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #667eea 50%, transparent 100%);
    margin-bottom: 20px;
    border-radius: 2px;
}

.dm-footer-credits {
    margin: 0;
    font-size: 15px;
    color: #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dm-footer-company {
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dm-footer-copyright {
    margin: 10px 0 0 0;
    font-size: 13px;
    color: #9ca3af;
}

/* ========================================
   Mobile Menu Toggle
   ======================================== */
.dm-mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #2563eb;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 2147483647;
    /* Maximum z-index */
    transition: transform 0.3s, box-shadow 0.3s;
    pointer-events: auto;
}

/* Ensure SVG inside button doesn't block clicks */
.dm-mobile-menu-toggle svg,
.dm-mobile-menu-toggle svg *,
.dm-mobile-menu-toggle path {
    pointer-events: none !important;
}

.dm-mobile-menu-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.dm-mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Only show mobile menu toggle on dashboard pages */
.dm-dashboard-content .dm-mobile-menu-toggle,
.dm-client-content .dm-mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* For pages with inline styles */
.dm-dashboard-content~.dm-mobile-menu-toggle,
.dm-client-content~.dm-mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Devices (< 768px) */
@media (max-width: 768px) {
    .dm-mobile-menu-toggle {
        display: none;
    }

    /* Only show mobile menu toggle on pages with sidebar */
    .dm-dashboard-content .dm-mobile-menu-toggle,
    .dm-client-content .dm-mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* For pages with inline styles */
    .dm-dashboard-content~.dm-mobile-menu-toggle,
    .dm-client-content~.dm-mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .dm-footer-credits {
        font-size: 13px;
        flex-direction: column;
    }

    .dm-footer-company {
        font-size: 16px;
    }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
    .dm-page-wrapper {
        padding-top: 65px;
        padding-bottom: 80px;
    }

    .dm-dashboard-content,
    .dm-client-content {
        padding: 15px 10px;
        width: 100%;
    }

    .dm-dashboard-content h1,
    .dm-client-content h1 {
        font-size: 20px;
    }

    .dm-stat-card {
        padding: 20px 15px;
    }

    .dm-stat-card p {
        font-size: 24px;
    }

    .dm-btn {
        width: 100%;
        text-align: center;
    }

    .dm-table {
        font-size: 12px;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.dm-mt-10 {
    margin-top: 10px;
}

.dm-mt-20 {
    margin-top: 20px;
}

.dm-mt-30 {
    margin-top: 30px;
}

.dm-mb-10 {
    margin-bottom: 10px;
}

.dm-mb-20 {
    margin-bottom: 20px;
}

.dm-mb-30 {
    margin-bottom: 30px;
}

.dm-text-center {
    text-align: center;
}

.dm-text-right {
    text-align: right;
}

.dm-flex {
    display: flex;
}

.dm-flex-wrap {
    flex-wrap: wrap;
}

.dm-gap-10 {
    gap: 10px;
}

.dm-gap-20 {
    gap: 20px;
}

.dm-hidden {
    display: none;
}

/* Print Styles */
@media print {

    .dm-sidebar,
    .dm-mobile-menu-toggle,
    .dm-header,
    .dm-footer {
        display: none !important;
    }

    .dm-page-wrapper {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .dm-dashboard-content,
    .dm-client-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}