/* --- 1. පොදු සැකසුම් (Global Styles) --- */
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 0; background: #ecf0f1; }
.container { max-width: 1000px; margin: 0 auto; padding: 15px; }
h1, h2, h3 { color: #2c3e50; margin-top: 0; }

/* --- 2. Dashboard සහ Admin සඳහා Navbar --- */
.navbar { 
    background: #2c3e50; 
    padding: 15px; 
    color: white; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
    border-radius: 5px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.navbar a { color: white; text-decoration: none; padding: 8px 15px; background: #c0392b; border-radius: 4px; font-weight: bold; font-size: 14px; }
.navbar span { font-weight: bold; }

/* --- 3. ආකෘති පත්‍ර සහ බොත්තම් (Forms & Inputs) --- */
input, select, button { 
    padding: 12px; 
    border: 1px solid #bdc3c7; 
    border-radius: 5px; 
    font-size: 14px; 
    box-sizing: border-box; 
    margin: 5px 0;
}

/* Dashboard එකේ Inputs සම්පූර්ණ පළලින් පෙන්වීමට */
.card form input, 
.card form select, 
.card form button { 
    width: 100%; 
}

/* බොත්තම් හැඩගැන්වීම */
button { cursor: pointer; background: #27ae60; color: white; border: none; font-weight: bold; transition: 0.3s; }
button:hover { background: #2ecc71; }
.btn-danger { background: #e74c3c; }
.btn-warning { background: #f39c12; }

/* --- 4. දත්ත ඇතුලත් කරන පෙට්ටි (Cards for Dashboard) --- */
.card { 
    background: white; 
    padding: 25px; 
    margin-bottom: 20px; 
    border-radius: 10px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.08); 
    border-left: 5px solid #3498db; /* නිල් පාට ඉරක් වම් පසින් */
}
.card h3 { border-bottom: 2px solid #ecf0f1; padding-bottom: 10px; margin-bottom: 20px; }

/* --- 5. Admin Panel වගු (Tables) --- */
table { width: 100%; border-collapse: collapse; margin-top: 10px; background: white; }
th, td { border: 1px solid #ddd; padding: 10px; text-align: left; }
th { background-color: #2980b9; color: white; }

/* --- 6. Index Page එකේ Grid View (මුල් පිටුවට අදාළයි) --- */
header { text-align: center; margin-bottom: 20px; background: white; padding: 15px; border-radius: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.item-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-top: 4px solid #27ae60;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.item-card:hover { transform: translateY(-3px); }

.item-img { width: 50px; height: 50px; object-fit: contain; margin-bottom: 8px; }
.item-name { font-size: 13px; font-weight: bold; color: #34495e; height: 35px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.count-text { font-size: 24px; color: #c0392b; font-weight: bold; margin-top: 5px; }
.unit-text { font-size: 11px; color: #95a5a6; }

/* --- 7. Index Page එකේ Login Bar --- */
.login-bar {
    background: #34495e;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap; /* ජංගම දුරකථන සඳහා */
}
.login-bar input { width: auto; min-width: 200px; border: none; }
.login-bar button { width: auto; background: #e67e22; padding: 12px 20px; }
.error-msg { width: 100%; text-align: center; color: #e74c3c; font-weight: bold; background: #fadbd8; padding: 5px; border-radius: 4px; margin-bottom: 10px; }

/* --- 8. Mobile Responsiveness (ජංගම දුරකථන සඳහා) --- */
@media (max-width: 600px) {
    /* Grid එක පේළියට 3ක් පෙන්වීමට */
    .item-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .item-card { padding: 10px 5px; }
    .item-img { width: 35px; height: 35px; }
    .item-name { font-size: 10px; height: 30px; }
    .count-text { font-size: 18px; }
    
    /* Login එක පහළට */
    .login-bar { flex-direction: column; }
    .login-bar input, .login-bar button { width: 100%; }
    
    /* වගු (Tables) */
    table, thead, tbody, th, td, tr { display: block; }
    th { position: absolute; top: -9999px; left: -9999px; }
    tr { border: 1px solid #ccc; margin-bottom: 10px; }
    td { border: none; border-bottom: 1px solid #eee; position: relative; padding-left: 50%; }
    td:before { position: absolute; top: 10px; left: 10px; width: 45%; padding-right: 10px; white-space: nowrap; content: attr(data-label); font-weight: bold; }
}