/* Device-responsive CSS for EasySys */

/* Base styles for all devices */
* {
    box-sizing: border-box;
}

/* Device-specific body classes */
body.device-mobile {
    font-size: 16px;
    line-height: 1.6;
}

body.device-tablet {
    font-size: 15px;
    line-height: 1.5;
}

body.device-desktop {
    font-size: 14px;
    line-height: 1.4;
}

/* Container responsive behavior */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

/* Navigation responsive behavior */
.navbar {
    position: relative;
}

.navbar-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 10px;
    background: none;
    border: none;
    position: absolute;
    right: 15px;
    top: 10px;
    z-index: 1001;
}

.navbar-toggle span {
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 3px 0;
    transition: 0.3s;
    display: block;
}

/* Card layouts */
.device-card-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.device-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.device-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.device-card h3 {
    margin-top: 0;
    color: #333;
}

/* Button styles */
.device-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    text-align: center;
}

.device-btn:hover {
    background-color: #0056b3;
    color: white;
    text-decoration: none;
}

.device-btn-sm {
    padding: 5px 10px;
    font-size: 0.875rem;
}

/* Table responsive */
.device-table-responsive {
    overflow-x: auto;
    margin: 20px 0;
}

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

.device-table th, 
.device-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.device-table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

/* Alert styles */
.device-alert {
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    border: 1px solid transparent;
}

.device-alert-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.device-alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.device-alert-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

/* Desktop styles (1025px and up) */
@media only screen and (min-width: 1025px) {
    .container {
        max-width: 1200px;
        padding: 30px;
    }
    
    .device-card-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .navbar-toggle {
        display: none !important;
    }
    
    .sidebar {
        width: 250px;
        position: fixed;
        left: 0;
        top: 60px;
        height: calc(100vh - 60px);
        background-color: #f8f9fa;
        overflow-y: auto;
        padding: 20px;
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 250px;
        padding: 20px;
    }
    
    .device-hide-desktop {
        display: none !important;
    }
}

/* Tablet styles (769px to 1024px) */
@media only screen and (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 20px;
    }
    
    .device-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .navbar-toggle {
        display: none !important;
    }
    
    .sidebar {
        width: 200px;
        position: fixed;
        left: -200px;
        top: 60px;
        height: calc(100vh - 60px);
        background-color: #f8f9fa;
        transition: left 0.3s;
        z-index: 1000;
        padding: 20px;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px;
    }
    
    .device-btn {
        padding: 8px 16px;
    }
    
    .device-hide-tablet {
        display: none !important;
    }
}

/* Mobile styles (up to 768px) */
@media only screen and (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .navbar {
        flex-wrap: wrap;
        padding: 10px 15px;
    }
    
    .navbar-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        margin-top: 10px;
        background-color: rgba(52, 58, 64, 0.95);
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1000;
        padding: 10px;
    }
    
    .navbar-nav.open {
        display: flex;
    }
    
    .navbar-nav li {
        margin: 5px 0;
    }
    
    .navbar-nav a {
        display: block;
        padding: 12px 15px;
        border-radius: 4px;
    }
    
    .navbar-toggle {
        display: flex !important;
    }
    
    .device-card-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .device-card {
        padding: 15px;
    }
    
    .sidebar {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 10px;
    }
    
    .device-btn {
        width: 100%;
        text-align: center;
        margin: 5px 0;
        padding: 12px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .device-table-responsive {
        font-size: 14px;
    }
    
    .device-table th, 
    .device-table td {
        padding: 8px 4px;
    }
    
    /* Hide less important columns on mobile */
    .device-hide-mobile {
        display: none !important;
    }
    
    /* Mobile-specific layout adjustments */
    .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    .col-12 {
        padding-left: 0;
        padding-right: 0;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
}

/* Touch-friendly elements for mobile/tablet */
@media (hover: none) and (pointer: coarse) {
    .device-btn, 
    .navbar-nav a, 
    .device-card {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
    
    .navbar-nav a {
        padding: 12px 15px;
    }
    
    .device-card {
        display: block;
    }
}

/* Device-specific utility classes */
.device-mobile-only {
    display: none;
}

.device-tablet-only {
    display: none;
}

.device-desktop-only {
    display: block;
}

@media only screen and (max-width: 768px) {
    .device-mobile-only {
        display: block;
    }
    
    .device-desktop-only {
        display: none;
    }
}

@media only screen and (min-width: 769px) and (max-width: 1024px) {
    .device-tablet-only {
        display: block;
    }
    
    .device-desktop-only {
        display: none;
    }
}

/* Loading states for better UX */
.device-loading {
    opacity: 0.6;
    pointer-events: none;
}

.device-loading::after {
    content: "Loading...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 4px;
}

/* Better touch targets */
@media (max-width: 768px) {
    input, button, select, textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}