/* DreamApp Customer Portal - Minimalistic Black & White Theme */

/* PWA Styles */
.install-btn {
    background: linear-gradient(135deg, #d4af37, #b98b22) !important;
    color: white !important;
    border: none !important;
    animation: pulse 2s infinite;
}

.install-btn:hover {
    background: linear-gradient(135deg, #b98b22, #9d741c) !important;
    transform: scale(1.05);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(212, 175, 55, 0); }
    100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); }
}

/* PWA Status Messages */
#pwa-status {
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #000;
    background-color: #fff;
    overflow-x: hidden;
}

/* Dark theme inspired by reference UI */
body.theme-dark {
    color: #EAEAEA;
    background-color: #0F1113;
}

.theme-dark .auth-card,
.theme-dark .vehicle-card,
.theme-dark .pdu-table,
.theme-dark .modal-content {
    background: #14171A;
    border-color: #1F2328;
}

.theme-dark .btn-primary,
.theme-dark button {
    background: #1F2328;
    border-color: #2B3138;
    color: #EAEAEA;
}

.theme-dark .btn-primary:hover,
.theme-dark button:hover {
    background: #0F1113;
    color: #EAEAEA;
}

.theme-dark .btn-secondary {
    background: #0F1113;
    color: #EAEAEA;
    border-color: #2B3138;
}

.theme-dark .btn-secondary:hover {
    background: #1F2328;
}

.theme-dark .page-header,
.theme-dark .stat-card,
.theme-dark .command-history,
.theme-dark .pdu-stats {
    border-color: #2B3138;
    background: #14171A;
}

.theme-dark .nav {
    background: #14171A;
    border-bottom-color: #2B3138;
}

.theme-dark .nav-link.active {
    border-bottom-color: #3A3F45;
}

.theme-dark input,
.theme-dark select,
.theme-dark .search-input {
    background: #0F1113;
    color: #EAEAEA;
    border-color: #2B3138;
}

.theme-dark .status-dot {
    border-color: #3A3F45;
}

.theme-dark .status-dot.online {
§    background: #b98b228f;
}

.theme-dark .status-dot.offline {
    background: #3A3F45;
}

.theme-dark .connection-status.connected {
    background: rgba(185,139,34,0.12);
    color: #b98b228f;
}

.theme-dark .connection-status.disconnected {
    background: rgba(241,90,90,0.12);
    color: #F15A5A;
}

.theme-dark .vehicle-thumb {
    background: linear-gradient(145deg, #1B2026, #0F1113);
    border-color: #2B3138;
}

.theme-dark .quick-actions .control-btn {
    background: #1B2026;
    border-color: #b98b228f;
}

.theme-dark .quick-actions .control-btn:hover {
    background: #0F1113;
}

/* Layout */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Loading Screen */
#loading {
    justify-content: center;
    align-items: center;
    background-color: #fff;
}

.loading-content {
    text-align: center;
}

.logo {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Authentication Screen */
#auth {
    justify-content: center;
    align-items: center;
    background-color: #f8f8f8;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.auth-card {
    background: #fff;
    border: 2px solid #000;
    padding: 2rem;
    text-align: center;
}

.auth-card .logo {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.auth-card h1 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    font-weight: 400;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input[type="email"],
input[type="password"],
input[type="text"],
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #b98b228f;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
}

input:focus,
select:focus {
    outline: none;
    border-color: #666;
    background: #f9f9f9;
}

/* Buttons */
.btn-primary,
.btn-secondary,
button {
    padding: 0.75rem 1.5rem;
    border: 2px solid #000;
    background: #000;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    transition: all 0.2s ease;
}


.btn-secondary {
    background: #fff;
    color: #000;
}

.btn-secondary:hover {
    background: #000;
    color: #fff;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Navigation */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 2px solid #000;
    background: #fff;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: 0;
}

.nav-link {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    color: #666;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
    border-bottom: 2px solid transparent;
}

.nav-link:hover {
    color: #000;
    background: none;
}

.nav-link.active {
    color: #000;
    border-bottom-color: #000;
}

.nav-link.logout {
    margin-left: 1rem;
    color: #000;
    border: 1px solid #000;
    padding: 0.5rem 1rem;
}

.nav-link.logout:hover {
    background: #000;
    color: #fff;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Pages */
.page {
    display: none;
}
/* Generic Table Styles */
.table-container {
    border: 2px solid #000;
    background: #fff;
    overflow: hidden;
}

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

.table thead tr {
    background: #000;
    color: #fff;
}

.table thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody td {
    padding: 0.75rem 1rem;
    border-top: 1px solid #eee;
}

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

.table-section {
    margin-bottom: 2rem;
}

.table-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.table .actions {
    display: flex;
    gap: 0.5rem;
}

.cell-input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid #ccc;
    font-family: inherit;
    font-size: 14px;
}

.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border: 1px solid #000;
    font-size: 12px;
}

.badge.on { background: #000; color: #fff; }
.badge.off { background: #fff; color: #000; }


.page.active {
    display: block;
}

.page-header {
    /* display: flex;
    justify-content: space-between; */
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #000;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 400;
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #000;
}

.status-dot.online {
    background: #b98b228f;
}

.status-dot.offline {
    background: #fff;
}

/* Vehicle Select */
.vehicle-select {
    min-width: 200px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    border: 2px solid #000;
    padding: 1.5rem;
    text-align: center;
    background: #fff;
}

.stat-number {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
}

/* Vehicles Grid */
.vehicles-section h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 500;
}

.vehicles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.vehicle-card {
    border: 2px solid #000;
    padding: 1.5rem;
    background: #fff;
}

/* Mobile control — compact vehicle card with thumb and quick actions */
.vehicle-card.mobile {
    display: flex;
    align-items: center;
    gap: 12px;
}
.vehicle-thumb {
    width: 72px;
    height: 44px;
    background: #eee;
    border: 1px solid #000;
}
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.quick-actions .control-btn {
    padding: 10px 8px;
}

.vehicle-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.vehicle-info {
    margin-bottom: 1rem;
    color: #666;
}

.vehicle-info div {
    margin-bottom: 0.25rem;
}

.vehicle-actions {
    display: flex;
    gap: 0.5rem;
}

.vehicle-actions button {
    flex: 1;
    padding: 0.5rem;
    font-size: 12px;
}

/* Control Content */
.control-content {
    max-width: 800px;
}

.control-section {
    margin-bottom: 2rem;
}

.control-section h3 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
    font-weight: 500;
}

.control-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.control-btn {
    padding: 1rem;
    font-size: 14px;
}

/* Command History */
.command-history {
    border: 1px solid #000;
    background: #f8f8f8;
    max-height: 300px;
    overflow-y: auto;
}

.command-item {
    padding: 0.75rem;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.command-action {
    font-weight: 500;
}

.command-status {
    font-size: 12px;
    padding: 0.25rem 0.5rem;
    border: 1px solid #000;
}

.command-status.success {
    background: #000;
    color: #fff;
}

.command-status.error {
    background: #fff;
    color: #000;
}

.command-time {
    font-size: 12px;
    color: #666;
}

/* PDU Content */
.pdu-content {
    max-width: 1000px;
}

.pdu-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    border: 1px solid #000;
    background: #f8f8f8;
}

.pdu-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pdu-stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
}

.pdu-stat-value {
    font-weight: 600;
}

/* PDU Table */
.pdu-table {
    border: 2px solid #000;
    background: #fff;
}

.table-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    background: #000;
    color: #fff;
}

.table-cell {
    padding: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.table-body {
    max-height: 400px;
    overflow-y: auto;
}

.table-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-bottom: 1px solid #ddd;
}

.table-row:last-child {
    border-bottom: none;
}

.table-row:hover {
    background: #f8f8f8;
}

.table-row .table-cell {
    background: none;
    color: #000;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    font-size: 14px;
}

.pdu-value {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.pdu-timestamp {
    color: #666;
    font-size: 12px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 4rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: #000;
    color: #fff;
    padding: 1rem 1.5rem;
    border: 2px solid #000;
    max-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast.error {
    background: #fff;
    color: #000;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: #fff;
    border: 2px solid #000;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    margin-bottom: 1rem;
    font-weight: 500;
}

.modal-content p {
    margin-bottom: 2rem;
    color: #666;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Error Messages */
.error-message {
    color: #000;
    background: #f8f8f8;
    border: 1px solid #000;
    padding: 1rem;
    margin-top: 1rem;
    text-align: center;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .vehicles-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .control-buttons {
        grid-template-columns: 1fr;
    }
    
    .pdu-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .table-header,
    .table-row {
        grid-template-columns: 1fr;
    }
    
    .table-cell {
        padding: 0.5rem;
        border-bottom: 1px solid #ddd;
    }
    
    .table-header .table-cell {
        background: #000;
        color: #fff;
        border-bottom: 1px solid #333;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: 'Courier New', monospace; }
.font-bold { font-weight: 600; }
.text-small { font-size: 12px; }
.text-muted { color: #666; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }

/* Real-time update animations */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* WebSocket connection status */
.connection-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.connection-status.connected {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.connection-status.disconnected {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* PDU controls */
.pdu-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #000;
}

.search-input::placeholder {
    color: #999;
}

/* PDU ID styling */
.pdu-id {
    display: block;
    color: #666;
    font-size: 11px;
    margin-top: 2px;
}

/* PDU table container for real-time updates */
.pdu-table-container {
    transition: box-shadow 0.3s ease;
    border-radius: 4px;
}

/* PDU value update highlight animation */
.pdu-updated {
    background-color: rgba(40, 167, 69, 0.2);
    transition: background-color 0.3s ease;
    border-radius: 2px;
    padding: 1px 3px;
}

.pdu-value.pdu-updated {
    font-weight: bold;
    color: #28a745;
}

.pdu-timestamp.pdu-updated {
    color: #28a745;
}

/* CTA: full-width wake button */
#wake-cta {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
