:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #1e3a8a;

    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;

    --background: #f5f7fb;
    --white: #ffffff;
    --gray: #6b7280;
    --border: #e5e7eb;

    --radius: 14px;

    --shadow: 0 10px 25px rgba(0, 0, 0, .08);

    --transition: .3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    background: var(--background);
    color: #374151;
}

a {
    text-decoration: none;
}

ul {
    list-style: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

.content {
    width: 100%;
    margin-left: 260px;
}

.fade {
    animation: fade .5s ease;
}

@keyframes fade {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;

    background: linear-gradient(
        135deg,
        #2563eb,
        #1e3a8a
    );
}

.login-box {

    width: 400px;

    background: white;

    padding: 40px;

    border-radius: 20px;

    box-shadow: var(--shadow);

}

.login-box h2 {

    text-align: center;

    color: var(--primary);

    margin-bottom: 8px;

    font-size: 32px;

}

.login-box p {

    text-align: center;

    color: #666;

    margin-bottom: 30px;

}

.login-box input {

    width: 100%;

    padding: 14px;

    border: 1px solid var(--border);

    border-radius: 10px;

    margin-bottom: 15px;

    outline: none;

    transition: var(--transition);

}

.login-box input:focus {

    border-color: var(--primary);

}

.login-box button {

    width: 100%;

    padding: 14px;

    border: none;

    background: var(--primary);

    color: white;

    font-size: 15px;

    border-radius: 10px;

    cursor: pointer;

    transition: var(--transition);

}

.login-box button:hover {

    background: var(--primary-dark);

}

.alert {

    padding: 12px;

    border-radius: 10px;

    margin-bottom: 15px;

    color: white;

}

.alert-danger {

    background: var(--danger);

}

.alert-success {

    background: var(--success);

}

.sidebar {

    position: fixed;

    top: 0;

    left: 0;

    width: 260px;

    height: 100vh;

    background: var(--secondary);

    color: white;

    padding: 25px;

    overflow-y: auto;

}

.logo {

    text-align: center;

    margin-bottom: 35px;

}

.logo h2 {

    font-size: 28px;

    margin-bottom: 8px;

}

.logo p {

    color: rgba(255,255,255,.8);

    font-size: 14px;

}

.sidebar ul li {

    margin-bottom: 10px;

}

.sidebar ul li a {

    display: block;

    color: white;

    padding: 14px 18px;

    border-radius: 10px;

    transition: var(--transition);

}

.sidebar ul li a:hover {

    background: #2563eb;

}

.sidebar ul li a i {

    width: 24px;

}

.navbar {

    height: 75px;

    background: white;

    box-shadow: var(--shadow);

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 0 30px;

    position: sticky;

    top: 0;

    z-index: 999;

}

.navbar h2 {

    color: var(--secondary);

}

.dashboard {

    padding: 30px;

}

.dashboard h1 {

    color: var(--secondary);

    margin-bottom: 10px;

}

.dashboard p {

    color: #666;

    margin-bottom: 30px;

}

.stats {

    display: grid;

    grid-template-columns: repeat(4,1fr);

    gap: 20px;

    margin-bottom: 30px;

}

.card {

    background: white;

    border-radius: 18px;

    padding: 25px;

    box-shadow: var(--shadow);

    transition: var(--transition);

}

.card:hover {

    transform: translateY(-6px);

}

.card h4 {

    color: #777;

    margin-bottom: 12px;

}

.card h2 {

    color: var(--primary);

    font-size: 34px;

}

.card span {

    display: block;

    margin-top: 10px;

    color: #888;

    font-size: 14px;

}

.toren-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.toren-card{

    background:#fff;

    border-radius:20px;

    padding:25px;

    box-shadow:0 8px 20px rgba(0,0,0,.08);

    min-height:560px;

    transition:.3s;

}

.toren-card:hover{

    transform:translateY(-5px);

}

.toren-card:hover {
    transform: translateY(-8px);
}

.toren-card h3{

    text-align:center;

    font-size:32px;

    color:#1f3c88;

    margin-bottom:20px;

}

.tank {
    width: 150px;
    height: 280px;
    margin: auto;
    border: 5px solid #6b7280;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    background: #eef4ff;
}

.tank::before {
    content: "";
    position: absolute;
    top: -16px;
    left: 20px;
    width: 100px;
    height: 14px;
    background: #6b7280;
    border-radius: 20px;
}

.tank::after {
    content: "";
    position: absolute;
    bottom: -14px;
    left: 30px;
    width: 80px;
    height: 10px;
    background: #6b7280;
    border-radius: 20px;
}

.water {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(
        to top,
        #1d4ed8,
        #3b82f6
    );
    transition: height .8s ease;
    overflow: hidden;
}

.water::before {
    content: "";
    position: absolute;
    left: -50%;
    top: -18px;
    width: 200%;
    height: 40px;
    background: rgba(255,255,255,.35);
    border-radius: 45%;
    animation: wave1 6s linear infinite;
}

.water::after {
    content: "";
    position: absolute;
    left: -50%;
    top: -25px;
    width: 200%;
    height: 50px;
    background: rgba(255,255,255,.2);
    border-radius: 45%;
    animation: wave2 8s linear infinite;
}

@keyframes wave1 {

    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(50%);
    }

}

@keyframes wave2 {

    from {
        transform: translateX(50%);
    }

    to {
        transform: translateX(0);
    }

}

.level-text{

    font-size:52px;

    font-weight:bold;

    text-align:center;

    color:#2962ff;

    margin-top:18px;

}

.volume-text{

    text-align:center;

    font-size:23px;

    color:#555;

    margin-top:8px;

}

.temperature {
    text-align: center;
    margin-top: 18px;
    font-size: 18px;
    color: #ef4444;
    font-weight: 600;
}

.sensor-info{

    display:flex;

    justify-content:space-between;

    margin-top:20px;

    font-size:17px;

}

.progress {
    width: 100%;
    height: 12px;
    margin-top: 18px;
    background: #e5e7eb;
    border-radius: 30px;
    overflow: hidden;
}

.progress div {
    height: 100%;
    width: 0%;
    background: linear-gradient(
        to right,
        #2563eb,
        #60a5fa
    );
    transition: width .8s ease;
}

.relay-box {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.relay{

    width:180px;

    margin:20px auto;

    display:block;

    border:none;

    border-radius:8px;

    padding:12px;

    color:#fff;

    font-size:18px;

    font-weight:bold;

}

.relay.open {
    background: var(--success);
    color: white;
}

.relay.close {
    background: var(--danger);
    color: white;
}

.relay:hover {
    transform: scale(1.05);
}

.alarm-box{

    text-align:center;

    padding:15px;

    border-radius:10px;

    font-size:18px;

    margin-top:15px;

}

.alarm-ok {
    background: #dcfce7;
    color: #166534;
}

.alarm-warning {
    background: #fef3c7;
    color: #92400e;
}

.alarm-low {
    background: #fee2e2;
    color: #991b1b;
}

.status-online {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--success);
    font-weight: 600;
}

.status-online::before {
    content: "";
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0% {
        box-shadow: 0 0 0 0 rgba(34,197,94,.7);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(34,197,94,0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34,197,94,0);
    }

}

.loader {
    width: 45px;
    height: 45px;
    margin: 60px auto;
    border: 5px solid #d1d5db;
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {

    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }

}

.chart-container {
    background: var(--white);
    margin-top: 35px;
    border-radius: 18px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.chart-container h3 {
    color: var(--secondary);
    margin-bottom: 20px;
}

.chart-container canvas {
    width: 100% !important;
    height: 350px !important;
}

.table-container {
    margin-top: 35px;
    background: var(--white);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h3 {
    color: var(--secondary);
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--primary);
    color: white;
}

table th {
    padding: 15px;
    text-align: left;
    font-size: 14px;
}

table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

table tbody tr {
    transition: var(--transition);
}

table tbody tr:hover {
    background: #f8fafc;
}

.btn {
    border: none;
    cursor: pointer;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 14px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    opacity: .9;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: bold;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-primary {
    background: #dbeafe;
    color: #1d4ed8;
}

.footer {
    margin-top: 40px;
    padding: 20px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.footer small {
    display: block;
    margin-top: 6px;
    color: #9ca3af;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #e5e7eb;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 30px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

@media (max-width:1200px) {

    .stats {
        grid-template-columns: repeat(2,1fr);
    }

    .toren-grid {
        grid-template-columns: repeat(2,1fr);
    }

}

@media (max-width:768px) {

    .sidebar {
        width: 80px;
        padding: 15px;
    }

    .logo p {
        display: none;
    }

    .logo h2 {
        font-size: 18px;
    }

    .sidebar ul li a {
        text-align: center;
        font-size: 0;
        padding: 15px;
    }

    .sidebar ul li a i {
        font-size: 22px;
        margin: 0;
        width: auto;
    }

    .content {
        margin-left: 80px;
    }

    .navbar {
        padding: 20px;
        flex-direction: column;
        gap: 10px;
        height: auto;
    }

    .dashboard {
        padding: 20px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .toren-grid {
        grid-template-columns: 1fr;
    }

    .tank {
        width: 130px;
        height: 240px;
    }

}

@media (max-width:480px) {

    .login-box {
        width: 95%;
        padding: 25px;
    }

    .dashboard h1 {
        font-size: 24px;
    }

    .card h2 {
        font-size: 28px;
    }

    .level-text {
        font-size: 30px;
    }

}

.glass {
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,.75);
}

.shadow-hover:hover {
    box-shadow: 0 20px 40px rgba(0,0,0,.15);
}

.rotate:hover {
    transform: rotate(2deg);
}

.scale:hover {
    transform: scale(1.03);
}

.blink {
    animation: blink 1s infinite;
}

@keyframes blink {

    0% {
        opacity: 1;
    }

    50% {
        opacity: .3;
    }

    100% {
        opacity: 1;
    }

}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-primary {
    color: var(--primary);
}

.bg-success {
    background: var(--success);
}

.bg-warning {
    background: var(--warning);
}

.bg-danger {
    background: var(--danger);
}

.bg-primary {
    background: var(--primary);
}

.text-center {
    text-align: center;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mt-30 {
    margin-top: 30px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-30 {
    margin-bottom: 30px;
}
.monitor-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:25px;
    margin-top:30px;
}

@media(max-width:1000px){

    .monitor-grid{

        grid-template-columns:1fr;

    }

}

.page-title{
    font-size:28px;
    font-weight:700;
    margin-bottom:5px;
}

.page-subtitle{
    color:#666;
    margin-bottom:25px;
}

.error-box{
    background:#ffe5e5;
    color:#d60000;
    padding:20px;
    border-radius:10px;
    text-align:center;
    font-weight:bold;
}

.relay-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(320px,1fr));
    gap:25px;
    margin-top:25px;
}

.relay-card{
    background:#fff;
    border-radius:18px;
    padding:25px;
    box-shadow:0 10px 25px rgba(0,0,0,.08);
    transition:.3s;
}

.relay-card:hover{
    transform:translateY(-5px);
}

.relay-title{
    font-size:24px;
    font-weight:bold;
    color:#1565c0;
    margin-bottom:20px;
}

.relay-status{
    text-align:center;
    font-size:22px;
    font-weight:bold;
    margin:20px 0;
}

.relay-open{
    color:#2e7d32;
}

.relay-close{
    color:#d32f2f;
}

.relay-button{
    display:flex;
    gap:15px;
}

.relay-button button{
    flex:1;
    border:none;
    border-radius:10px;
    padding:15px;
    cursor:pointer;
    color:#fff;
    font-size:16px;
    font-weight:bold;
}

.btn-open{
    background:#2e7d32;
}

.btn-close{
    background:#d32f2f;
}

.last-update{
    margin-top:20px;
    text-align:center;
    color:#777;
    font-size:14px;
}