/* --- Κοινά για main area --- */
.main-content-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
}
.main-card {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    padding: 30px;
    margin-bottom: 32px;
    border: none;
}
.main-title {
    color: #233044;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 18px;
    margin-top: 0;
}
.main-subtitle {
    color: #64748b;
    font-size: 1.1rem;
    margin-bottom: 24px;
}

    /* --- Βασικά & Layout --- */
    body {
        font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
        background-color: #f0f2f5;
        color: #333;
        line-height: 1.6;
        margin: 0;
        display: flex;
        height: 100vh;
        /* overflow: hidden; */
    }

    .container {
        display: flex;
        width: 100%;
        height: 100%;
    }

    /* --- Sidebar (Αριστερή Στήλη) --- */
    .sidebar {
        width: 300px;
        background-color: #233044;
        color: white;
        display: flex;
        flex-direction: column;
        padding: 20px;
        box-shadow: 2px 0 5px rgba(0,0,0,0.1);
        overflow-y: auto;
    }

    .search-box {
        width: 100%;
        padding: 10px;
        border-radius: 4px;
        border: none;
        margin-bottom: 20px;
        box-sizing: border-box;
    }

    .customer-link {
        display: block;
        color: #e0e0e0;
        text-decoration: none;
        padding: 12px;
        border-radius: 4px;
        margin-bottom: 5px;
        transition: all 0.2s;
        border-left: 3px solid transparent;
    }

    .customer-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
        padding-left: 18px;
    }

    .customer-link.active {
        background-color: #1a6b4a;
        color: white;
        border-left: 3px solid #fff;
    }

    /* --- Main Content (Δεξιά Στήλη) --- */
    .main {
        flex: 1;
        padding-left: 30px;
        overflow-y: auto;
        background-color: #f4f7f9;
    }

    #main-content {
        max-width: 1100px;
        margin: 0 auto;
    }

    /* --- Κάρτες & Containers --- */
    .customer-info, .tab-container {
        background: white;
        padding: 25px;
        border-radius: 10px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05);
        margin-bottom: 25px;
        animation: fadeIn 0.3s ease;
    }

    h2 { color: #0a4a34; margin-top: 0; padding-bottom: 10px; border-bottom: 1px solid #eee; }
    h3 { color: #1a6b4a; margin-top: 0; }

    /* --- Tabs Styling --- */
    .tabs {
        display: flex;
        gap: 8px;
        border-bottom: 2px solid #eef2f6;
        margin-bottom: 20px;
    }

    .tab-btn {
        padding: 12px 20px;
        cursor: pointer;
        background: none;
        border: none;
        border-bottom: 3px solid transparent;
        font-weight: 600;
        color: #78909c;
        transition: 0.3s;
    }

    .tab-btn:hover { color: #1a6b4a; background: #f0faf4; }

    .tab-btn.active {
        color: #1a6b4a;
        border-bottom-color: #1a6b4a;
    }

    .tab-content { display: none; padding-top: 10px; }
    .tab-content.active { display: block; animation: fadeIn 0.4s ease; }

    /* --- Λίστες & Συσκευές --- */
    .device-list-item {
        padding: 15px;
        border: 1px solid #e0e6ed;
        border-radius: 8px;
        margin-bottom: 10px;
        cursor: pointer;
        background: #fff;
        transition: 0.2s;
    }

    .device-list-item:hover { border-color: #1a6b4a; background: #f0faf4; transform: translateY(-2px); }

    .credential-card {
        background: #f8fafc;
        border-left: 4px solid #1a6b4a;
        padding: 15px;
        margin-bottom: 12px;
        border-radius: 0 6px 6px 0;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }

    /* --- Κουμπιά --- */
    .new-btn {
        background-color: #0a4a34;
        color: white;
        border: none;
        padding: 12px 20px;
        border-radius: 6px;
        font-weight: bold;
        cursor: pointer;
        width: 100%;
        margin-bottom: 15px;
        transition: background 0.2s;
    }

    .new-btn:hover { background-color: #083d2a; }

    button[type="submit"] {
        background-color: #2e7d32;
        color: white;
        border: none;
        padding: 10px 20px;
        border-radius: 4px;
        cursor: pointer;
    }

    button#cancel-add-customer, button#close-credential-modal {
        background-color: #d32f2f;
        color: white;
        border: none;
        padding: 10px 20px;
        border-radius: 4px;
        cursor: pointer;
        margin-left: 10px;
    }

    /* --- Φόρμες --- */
    form label { display: block; margin-bottom: 8px; font-weight: 600; color: #455a64; }
    input[type="text"], input[type="password"], textarea, select {
        width: 100%;
        padding: 12px;
        border: 1px solid #cfd8dc;
        border-radius: 6px;
        margin-top: 5px;
        box-sizing: border-box;
    }
    textarea { height: 100px; resize: vertical; }

    /* --- Modal --- */
    #credential-modal {
        display: none;
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        align-items: center;
        justify-content: center;
        z-index: 9999;
    }

    .modal-content {
        background: white;
        padding: 30px;
        border-radius: 12px;
        width: 500px;
        max-width: 90%;
        box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    }

    /* --- Animations --- */
    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(5px); }
        to { opacity: 1; transform: translateY(0); }
    }

/* --- Credential Rows --- */
.cred-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #94a3b8;
    margin: 18px 0 6px 0;
}
.cred-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e9eef4;
    margin-bottom: 6px;
    transition: background 0.15s;
    position: relative;
}
.cred-row:hover { background: #f0faf4; border-color: #b8dece; }
.cred-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    background: #e8f5ee;
    color: #1a6b4a;
    white-space: nowrap;
    flex-shrink: 0;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cred-name {
    font-size: 13px;
    color: #64748b;
    min-width: 80px;
    flex-shrink: 0;
}
.cred-username {
    font-size: 13px;
    font-weight: 600;
    color: #233044;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cred-password {
    font-size: 13px;
    font-family: monospace;
    color: #475569;
    letter-spacing: 2px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cred-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.cred-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 5px;
    border-radius: 5px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}
.cred-action-btn:hover { color: #1a6b4a; background: #e8f5ee; }
.cred-action-btn.danger:hover { color: #e53935; background: #fdecea; }
/* Kebab dropdown */
.cred-kebab-wrapper { position: relative; }
.cred-kebab-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    z-index: 50;
    min-width: 130px;
    overflow: hidden;
}
.cred-kebab-menu.open { display: block; }
.cred-kebab-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    font-size: 13px;
    cursor: pointer;
    color: #334e68;
    transition: background 0.12s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.cred-kebab-item:hover { background: #f1f5f9; }
.cred-kebab-item.danger { color: #e53935; }
.cred-kebab-item.danger:hover { background: #fdecea; }
/* =========================================
   MOBILE RESPONSIVE
   ========================================= */
@media (max-width: 768px) {

    /* Inner content container: edge-to-edge on mobile */
    #main-inner-container { padding: 8px 0 !important; }

    /* Main container */
    .main-content-container { padding: 10px 0; }
    .main-card { padding: 14px; border-radius: 8px; margin-bottom: 12px; }

    /* Customer info compact */
    .customer-info { padding: 12px 14px !important; margin-bottom: 10px !important; }

    /* Tab container */
    .tab-container { padding: 12px 10px !important; border-radius: 8px !important; }

    /* Tabs: scrollable horizontal */
    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 4px;
        padding-bottom: 2px;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab-btn {
        white-space: nowrap;
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Master-detail: stacked */
    #devices-area {
        flex-direction: column !important;
        gap: 0 !important;
    }
    .device-list-panel {
        width: 100% !important;
        flex-shrink: unset !important;
    }
    .device-detail-panel {
        width: 100% !important;
        min-height: 300px !important;
    }

    /* When a device is selected on mobile: hide list, show detail */
    #devices-area.show-detail .device-list-panel { display: none !important; }
    #devices-area.show-detail .device-detail-panel { display: block !important; }

    /* Back button - mobile only */
    .mobile-back-btn {
        display: inline-flex !important;
        align-items: center;
        gap: 6px;
        background: none;
        border: none;
        color: #1a6b4a;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        padding: 8px 0 12px 0;
    }

    /* Single device: no list panel on mobile */
    #devices-area.single-device .device-list-panel { display: none !important; }
    #devices-area.single-device .device-detail-panel { display: block !important; }

    /* Credential table: make it scrollable */
    .credentials-table { font-size: 12px; }

    /* Modal full-screen on mobile */
    .modal-content { width: 92% !important; padding: 20px !important; }

    /* Form grid single column */
    .form-grid { grid-template-columns: 1fr !important; }
    .info-grid { grid-template-columns: 1fr 1fr !important; }
}

/* Back button hidden on desktop */
.mobile-back-btn { display: none; }