/* =========================================
   RESET
========================================= */
*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

:root{
    --primary:#4DB748;
    --primary-dark:#3d9439;
    --secondary:#34495e;
    --danger:#dc3545;
    --light:#f5f7fa;
    --white:#ffffff;
    --border:#e6e6e6;
    --text:#2c3e50;
    --shadow:0 5px 20px rgba(0,0,0,0.08);
    --radius:12px;
}

body{
    font-family:'Segoe UI', sans-serif;
    background:var(--light);
    color:var(--text);
    line-height:1.5;
    overflow-x:hidden;
}

/* =========================================
   LAYOUT
========================================= */
.wrapper{
    display:flex;
    min-height:100vh;
    width:100%;
}

/* =========================================
   SIDEBAR
========================================= */
.left-sidebar{
    width:280px;
    background:var(--white);
    border-right:1px solid var(--border);
    box-shadow:var(--shadow);
    z-index:10;
}

.card{
    padding:25px;
    display:flex;
    flex-direction:column;
    gap:20px;
}

.header h2,
.header h3{
    margin-bottom:5px;
}

.header p{
    color:#666;
    font-size:14px;
}

/* MENU */
.dashboard-menu{
    display:flex;
    flex-direction:column;
    gap:12px;
}

/* =========================================
   MAIN CONTENT
========================================= */
.right-content{
    flex:1;
    padding:25px;
    width:100%;
    overflow:hidden;
}

.table-container{
    width:100%;
    background:var(--white);
    border-radius:var(--radius);
    padding:20px;
    box-shadow:var(--shadow);
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
}

/* =========================================
   SEARCH
========================================= */
.search{
    margin:20px 0;
}

.search input{
    width:100%;
    padding:12px 15px;
    border:1px solid #ccc;
    border-radius:10px;
    outline:none;
    transition:0.3s;
    background:var(--white);
}

.search input:focus{
    border-color:var(--primary);
    box-shadow:0 0 0 3px rgba(77,183,72,0.2);
}

/* =========================================
   TABLE
========================================= */
table{
    width:100%;
    border-collapse:collapse;
    background:var(--white);
}

th{
    background:var(--primary);
    color:var(--white);
    padding:14px;
    text-align:center;
    font-size:14px;
    white-space:nowrap;
}

td{
    padding:14px;
    border-bottom:1px solid #eee;
    text-align:center;
    font-size:14px;
}

tr:hover{
    background:#f9f9f9;
}

/* =========================================
   BADGE
========================================= */
.badge{
    background:var(--primary);
    color:var(--white);
    padding:6px 12px;
    border-radius:30px;
    font-size:13px;
    font-weight:600;
    display:inline-block;
}

/* =========================================
   BUTTONS
========================================= */
button,
a.btn-delete{
    border:none;
    padding:12px 16px;
    border-radius:10px;
    cursor:pointer;
    font-weight:600;
    transition:0.3s;
    text-decoration:none;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
}

button:hover,
a.btn-delete:hover{
    transform:translateY(-2px);
    opacity:0.95;
}

.btn-add{
    background:var(--primary);
    color:var(--white);
}

.btn-add:hover{
    background:var(--primary-dark);
}

.btn-secondary{
    background:var(--secondary);
    color:var(--white);
}

.btn-back{
    background:#2c3e50;
    color:var(--white);
}

.btn-delete{
    background:var(--danger);
    color:var(--white);
}

.btn-edit{
    background:#6c5ce7;
    color:white;
}

/* =========================================
   FORM
========================================= */
.form-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:15px;
    margin-top:20px;
}

.full{
    grid-column:span 2;
}

.input-group{
    display:flex;
    flex-direction:column;
    gap:6px;
}

label{
    font-size:14px;
    font-weight:600;
}

input,
select,
textarea{
    width:100%;
    padding:12px;
    border:1px solid #ccc;
    border-radius:10px;
    outline:none;
    transition:0.3s;
    background:var(--white);
}

input:focus,
select:focus,
textarea:focus{
    border-color:var(--primary);
    box-shadow:0 0 0 3px rgba(77,183,72,0.15);
}

/* ACTIONS */
.actions{
    display:flex;
    gap:10px;
    margin-top:20px;
    flex-wrap:wrap;
}

/* =========================================
   MODAL
========================================= */
.modal{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.6);
    justify-content:center;
    align-items:center;
    padding:20px;
    z-index:999;
}

.modal-content{
    background:var(--white);
    width:100%;
    max-width:700px;
    border-radius:var(--radius);
    padding:25px;
    max-height:90vh;
    overflow-y:auto;
    animation:fadeIn 0.3s ease;
}

@keyframes fadeIn{
    from{
        opacity:0;
        transform:translateY(-20px);
    }
    to{
        opacity:1;
        transform:translateY(0);
    }
}

/* =========================================
   LOGIN PAGE
========================================= */
.login-page{
    min-height:100vh;
    display:flex;
    justify-content:center;
    align-items:center;
    background:linear-gradient(135deg,var(--primary),#2c3e50);
    padding:20px;
}

.login-container{
    width:100%;
    max-width:400px;
    background:var(--white);
    padding:35px;
    border-radius:18px;
    box-shadow:0 20px 40px rgba(0,0,0,0.2);
    display:flex;
    flex-direction:column;
    gap:18px;
}

.logo{
    width:90px;
    margin:auto;
}

/* =========================================
   ALERTS
========================================= */
.alert-success{
    background:#d4edda;
    color:#155724;
    padding:12px;
    border-left:4px solid #28a745;
    border-radius:6px;
}

.alert-warning{
    background:#fff3cd;
    color:#856404;
    padding:12px;
    border-left:4px solid #ff6b6b;
    border-radius:6px;
}

/* =========================================
   RESPONSIVE TABLET
========================================= */
@media(max-width:992px){

    .wrapper{
        flex-direction:column;
    }

    .left-sidebar{
        width:100%;
        border-right:none;
        border-bottom:1px solid var(--border);
    }

    .dashboard-menu{
        flex-direction:row;
        flex-wrap:wrap;
        gap:10px;
    }

    .dashboard-menu button{
        flex:1 1 45%;
        min-width:140px;
    }

    .right-content{
        padding:20px;
    }
}

/* =========================================
   MOBILE
========================================= */
@media(max-width:768px){

    .right-content{
        padding:12px;
    }

    .card,
    .table-container,
    .modal-content,
    .login-container{
        padding:15px;
    }

    .form-grid{
        grid-template-columns:1fr;
    }

    .full{
        grid-column:span 1;
    }

    .actions{
        flex-direction:column;
    }

    .actions button,
    button,
    .btn-delete,
    .btn-edit,
    .btn-add,
    .btn-secondary,
    .btn-back{
        width:100%;
    }

    /* =====================================
       RESPONSIVE TABLE MOBILE
    ===================================== */

    table,
    thead,
    tbody,
    th,
    td,
    tr{
        display:block;
        width:100%;
    }

    thead{
        display:none;
    }

    table{
        border:0;
    }

    tr{
        background:var(--white);
        margin-bottom:15px;
        border-radius:12px;
        padding:12px;
        box-shadow:0 3px 10px rgba(0,0,0,0.05);
    }

    td{
        display:flex;
        justify-content:space-between;
        align-items:center;
        text-align:right;
        padding:10px 5px;
        border-bottom:1px solid #f1f1f1;
        font-size:13px;
        gap:10px;
        word-break:break-word;
    }

    td:last-child{
        border-bottom:none;
    }

    td::before{
        content:attr(data-label);
        font-weight:700;
        color:var(--secondary);
        text-align:left;
        flex:1;
    }

    td span,
    td button,
    td a{
        flex:1;
        justify-content:flex-end;
    }
}

/* =========================================
   SMALL MOBILE
========================================= */
@media(max-width:480px){

    .card,
    .table-container,
    .modal-content,
    .login-container{
        padding:12px;
    }

    .logo{
        width:70px;
    }

    h1{
        font-size:22px;
    }

    h2{
        font-size:20px;
    }

    h3{
        font-size:18px;
    }

    p,
    td,
    th,
    label{
        font-size:12px;
    }

    input,
    select,
    textarea,
    button{
        font-size:14px;
    }

    .dashboard-menu{
        flex-direction:column;
    }

    .dashboard-menu button{
        width:100%;
    }
}