/* === ตั้งค่าพื้นฐาน === */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* === ส่วนหัว === */
header {
    background-color: #333;
    color: white;
    padding: 20px 0;
    font-size: 24px;
    text-align: center;
    box-sizing: border-box;

    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    width: 80%;
    margin: 0 auto;
}

header h1 {
    font-size: 28px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: solid 1px #FF8C00;
}

header nav {
    margin-top: 10px;
}

header nav a {
    color: white;
    text-decoration: none;
    margin: 0 15px;
    font-size: 18px;
    padding: 5px 10px;
    border-radius: 15px;
    transition: background-color 0.3s ease;
/*    background-color: #000000; /* สีดำ */*/
}

header nav a:hover {
    background-color: #FF8C00; /* สีส้ม */
    color: white;
}

/* === แดชบอร์ด === */
.card {
    display: inline-block;
    margin: 15px;
    padding: 30px 20px;
    border-radius: 35px;
    color: white;
    font-size: 28px;
    text-align: center;
    width: 20%;
    box-sizing: border-box;
}

.card.orange {
    background-color: #FF8C00; /* สีส้ม */
}

.card.green {
    background-color: #4CAF50; /* สีเขียว */
}

.card.red {
    background-color: red; 
    color: white;
}

.db{
    display: flex;
    justify-content: center;
}

/* === ตาราง === */
table.styled-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin-top: 1.5em;
    margin-bottom: 3em;
    background-color: white;
    border-radius:0 0 20px 20px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}

table.styled-table th {
    background: linear-gradient(90deg, #000000,#333333);
    color: white;
    text-align: left;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 2px solid #e0e0e0;
}

table.styled-table td {
    padding: 14px 20px;
    border: 1px solid #e0e0e0;
    vertical-align: middle;
    background-color: #fff;
}

table.styled-table tbody tr:nth-child(even) td {
    background-color: #f9f9f9;
}

table.styled-table tr:hover td {
    background-color: #f1f1f1;
}

table.styled-table img {
    border-radius: 6px;
    transition: transform 0.2s;
    max-width: 100%;
    height: auto;
}

table.styled-table img:hover {
    transform: scale(1.05);
    cursor: pointer;
}

.styled-table tbody tr{
    transition:.2s;
}

.styled-table tbody tr:hover{
    transform:scale(1.01);
    box-shadow:0 2px 8px rgba(0,0,0,.1);
}


/* === ฟอร์ม === */
form {
    width: 50%;
    margin: 40px auto;
    padding: 30px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

form h2 {
    text-align: center;
    color: #333;
    font-size: 24px;
    margin-bottom: 20px;
}

form label {
    font-size: 18px;
    margin-bottom: 10px;
    display: block;
}

form input, form textarea, form button {
    width: 100%;
    padding: 12px;
    margin: 10px 0 20px;
    border-radius: 5px;
    border: 1px solid #ddd;
    box-sizing: border-box;
}

form input[type="text"], form textarea {
    font-size: 16px;
    resize: vertical;
}

form textarea {
    height: 150px;
}

form input[type="file"] {
    padding: 8px;
    font-size: 16px;
}

form button {
    background-color: #4CAF50; /* สีเขียว */
    color: white;
    font-size: 18px;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s;
}

form button:hover {
    background-color: #45a049;
}

form p {
    text-align: center;
    font-size: 18px;
}

form select {
    width: 100%;
    padding: 12px;
    margin: 10px 0 20px;
    border-radius: 5px;
    border: 1px solid #ddd;
    box-sizing: border-box;
    font-size: 16px;
    background-color: #fff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='gray' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
    cursor: pointer;
}

form select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2); /* สีเขียวอ่อน */
}


/* === Lightbox Modal === */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.lightbox-content {
    max-width: 80%;
    max-height: 80%;
    margin: 50px auto;
    display: block;
}

.close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #ccc;
    text-decoration: none;
    cursor: pointer;
}

/* === ปรับรูปภาพในตาราง === */
.styled-table img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
}

/* === ปรับการจัดวางและระยะห่าง === */
.container {
    padding-left: 30px;
    padding-right: 30px;
}


form {
    margin: 20px auto;
    width: 60%;
    box-sizing: border-box;
}

/* === Footer === */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 10px 0;
    font-size: 16px;
    position: relative;
    bottom: 0;
    width: 100%;
    margin-top: auto; /* ให้ footer อยู่ด้านล่าง */
}

footer p {
    margin: 0;
    font-size: 14px;
}


/* ทำให้ตารางเลื่อนในมือถือ โดยไม่กระทบ header/footer */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    table.styled-table {
        width: 900px; /* กำหนดความกว้างเกินหน้าจอมือถือ */
    }

    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .card {
        display: inline-block;
        margin: 15px;
        padding: 20px;
        border-radius: 15px;
        color: white;
        font-size: 18px;
        text-align: center;
        width: 30%;
        box-sizing: border-box;
    }

    form {
        margin: 5px auto;
        width: 90%;
        box-sizing: border-box;
    }

    form select {
        width: 100%;
        padding: 12px;
        margin: 10px 0 20px;
        border-radius: 5px;
        border: 1px solid #ddd;
        box-sizing: border-box;
        font-size: 16px;
        background-color: #fff;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='gray' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 16px 16px;
        cursor: pointer;
    }

    form select:focus {
        outline: none;
        border-color: #4CAF50;
        box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2); /* สีเขียวอ่อน */
    }
}


/* =========================
   LOGIN PAGE
========================= */

.login-page{
    min-height:75vh;
    display:flex;
    justify-content:center;
    align-items:center;
    padding:30px;
}

.login-box{
    width:100%;
    max-width:450px;
    background:#fff;
    border-radius:25px;
    padding:40px;
    box-shadow:0 15px 40px rgba(0,0,0,.15);
    text-align:center;
}

.login-logo{
    width:90px;
    height:90px;
    background:linear-gradient(135deg,#ff9800,#ff5722);
    border-radius:50%;
    margin:auto;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:40px;
    color:#fff;
}

.login-box h2{
    margin-top:20px;
    margin-bottom:5px;
    color:#222;
    font-size:30px;
}

.login-box p{
    color:#888;
    margin-bottom:30px;
}

.login-form{
    width:100% !important;
    margin:0 !important;
    padding:0 !important;
    background:none !important;
    box-shadow:none !important;
}

.login-form input[type=text],
.login-form input[type=password]{
    width:100%;
    padding:15px;
    margin-bottom:15px;
    border:2px solid #eee;
    border-radius:12px;
    font-size:16px;
    transition:.3s;
}

.login-form input:focus{
    border-color:#ff9800;
    outline:none;
}

.remember-row{
    text-align:left;
    margin-bottom:20px;
}

.remember-row label{
    font-size:15px;
    display:flex;
    align-items:center;
    gap:8px;
}

.remember-row input{
    width:auto !important;
    margin:0 !important;
}

.login-btn{
    width:100%;
    padding:15px;
    border:none;
    border-radius:12px;
    background:linear-gradient(135deg,#ff9800,#ff5722);
    color:#fff;
    font-size:18px;
    font-weight:bold;
    cursor:pointer;
    transition:.3s;
}

.login-btn:hover{
    transform:translateY(-2px);
    box-shadow:0 8px 20px rgba(255,152,0,.4);
}


/* =========================
   REPAIR FORM
========================= */

.repair-page{
    display:flex;
    justify-content:center;
    padding:30px;
}

.repair-card{
    width:100%;
    max-width:850px;
    background:#fff;
    border-radius:25px;
    padding:40px;
    box-shadow:0 15px 40px rgba(0,0,0,.12);
}

.repair-header{
    text-align:center;
    margin-bottom:30px;
}

.repair-icon{
    width:90px;
    height:90px;
    margin:auto;
    border-radius:50%;
    background:linear-gradient(135deg,#ff9800,#ff5722);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:40px;
    color:white;
}

.repair-header h2{
    margin-top:20px;
    margin-bottom:10px;
    color:#222;
    font-size:30px;
}

.repair-header p{
    color:#888;
}

.repair-form{
    width:100% !important;
    margin:0 !important;
    padding:0 !important;
    background:none !important;
    box-shadow:none !important;
}

.repair-form .form-group{
    margin-bottom:20px;
}

.repair-form label{
    display:block;
    margin-bottom:8px;
    font-weight:600;
    color:#333;
}

.repair-form input,
.repair-form textarea,
.repair-form select{
    width:100%;
    padding:14px;
    border:2px solid #ececec;
    border-radius:12px;
    font-size:16px;
    box-sizing:border-box;
    transition:.3s;
}

.repair-form textarea{
    min-height:150px;
}

.repair-form input:focus,
.repair-form textarea:focus,
.repair-form select:focus{
    border-color:#ff9800;
    outline:none;
}

.repair-btn{
    width:100%;
    padding:16px;
    border:none;
    border-radius:12px;
    background:linear-gradient(135deg,#ff9800,#ff5722);
    color:white;
    font-size:18px;
    font-weight:bold;
    cursor:pointer;
    transition:.3s;
}

.repair-btn:hover{
    transform:translateY(-2px);
    box-shadow:0 10px 20px rgba(255,152,0,.35);
}

@media(max-width:768px){

    .repair-card{
        padding:25px;
    }

    .repair-header h2{
        font-size:22px;
    }

}



/*อัพโหลด*/

.upload-area{
    margin-top:10px;
}

.upload-area input[type=file]{
    display:none;
}

.custom-upload{
    display:block;
    width:100%;
    box-sizing:border-box;   /* เพิ่มบรรทัดนี้ */

    padding:25px;
    border:3px dashed #ff9800;
    border-radius:15px;
    background:#fff8f0;
    color:#ff6f00;
    text-align:center;
    cursor:pointer;
    font-size:20px;
    font-weight:bold;
    transition:.3s;
}

.custom-upload:hover{
    background:#fff1e0;
}

#preview{
    margin-top:15px;
    text-align:center;
}

#preview img{
    max-width:250px;
    max-height:250px;
    border-radius:12px;
    box-shadow:0 4px 10px rgba(0,0,0,.15);
}

/* ==========================
   DASHBOARD
========================== */

.dashboard-page{
    padding:30px;
}

.dashboard-header{
    text-align:center;
    margin-bottom:35px;
}

.dashboard-icon{
    font-size:60px;
    margin-bottom:10px;
}

.dashboard-header h2{
    margin:0;
    color:#333;
    font-size:32px;
}

.dashboard-header p{
    color:#777;
    margin-top:10px;
}

/* cards */

.dashboard-cards{
    display:flex;
    justify-content:center;
    gap:25px;
    margin-bottom:40px;
    flex-wrap:wrap;
}

.stat-card{
    width:280px;
    border-radius:20px;
    padding:30px;
    color:white;
    text-align:center;
    box-shadow:0 8px 25px rgba(0,0,0,.15);
    transition:.3s;
}

.stat-card:hover{
    transform:translateY(-5px);
}

.waiting{
    background:linear-gradient(
        135deg,
        #ff9800,
        #ff6f00
    );
}

.success{
    background:linear-gradient(
        135deg,
        #4CAF50,
        #2e7d32
    );
}

.stat-icon{
    font-size:45px;
    margin-bottom:10px;
}

.stat-title{
    font-size:20px;
    margin-bottom:10px;
}

.stat-number{
    font-size:42px;
    font-weight:bold;
}

/* title */

.section-title{
    font-size:24px;
    font-weight:bold;
    margin-bottom:15px;
    color:#333;
}


.problem-cell{
    max-width:250px;
    white-space:normal;
    overflow-wrap:break-word;
    word-break:break-word;
}

.status-btn{
    background:#e53935;
    color:#fff;
    border:none;
    padding:10px 15px;
    border-radius:10px;
    cursor:pointer;
    font-weight:bold;
    transition:.3s;
}

.status-btn:hover{
    background:#c62828;
}

.repair-image{
    width:80px;
    height:80px;
    object-fit:cover;
    border-radius:10px;
}

.done-row td{
    background:#f1fff1 !important;
}

.total-ticket{
    margin-bottom:15px;
    font-weight:bold;
    color:#555;
}


/* ===== Status Badge ===== */

.badge{
    display:inline-block;
    padding:8px 14px;
    border-radius:30px;
    color:#fff;
    font-size:14px;
    font-weight:bold;
    text-align:center;
}

.badge-wait{
    background:#ff9800;
}

.badge-success{
    background:#4caf50;
}



/* ===== Search Box ===== */

.search-box{
    margin:20px 0;
}

#searchInput{
    width:100%;
    max-width:100%;
    padding:14px 18px;
    font-size:16px;
    border:2px solid #e0e0e0;
    border-radius:12px;
    box-sizing:border-box;
    outline:none;
    transition:.3s;
}

#searchInput:focus{
    border-color:#ff9800;
    box-shadow:0 0 10px rgba(255,152,0,.2);
}

/* Mobile */
@media (max-width:768px){

    .search-box{
        width:100%;
        overflow:hidden;
    }

    #searchInput{
        width:100%;
        font-size:15px;
    }

}


/* ===== Table Header ===== */

.table-header{
    background:#ffffff;
    border-radius:18px 18px 0 0;
    padding:20px 25px;

    display:flex;
    justify-content:space-between;
    align-items:center;

    border-bottom:3px solid #ff9800;

    box-shadow:0 4px 15px rgba(0,0,0,.08);
}

.table-title h3{
    margin:0;
    font-size:24px;
    color:#333;
    font-weight:700;
}

.table-title span{
    display:block;
    margin-top:5px;
    color:#888;
    font-size:14px;
}

.table-search{
    width:350px;
}

.search-box{
    margin:0;
}

.search-box input{
    width:100%;
    padding:12px 16px;
    border:1px solid #ddd;
    border-radius:12px;
    font-size:15px;
    box-sizing:border-box;
    transition:.3s;
}

.search-box input:focus{
    border-color:#ff9800;
    box-shadow:0 0 10px rgba(255,152,0,.15);
    outline:none;
}

/* ทำให้หัวติดกับตาราง */

.styled-table{
    margin-top:0 !important;
    border-radius:0 0 18px 18px !important;
}

/* มือถือ */

@media(max-width:768px){

    .table-header{
        flex-direction:column;
        gap:15px;
        text-align:center;
    }

    .table-search{
        width:100%;
    }

    .table-title h3{
        font-size:20px;
    }

}

.dashboard-icon{
    text-align:center;
    margin-bottom:15px;
}

.dashboard-icon img{
    width:100px;
    height:100px;
    object-fit:contain;
}


/* ===== REPORT PAGE ===== */

.report-page{
    padding:20px;
}

.report-header{
    text-align:center;
    margin-bottom:30px;
}

.report-icon img{
    width:90px;
    height:90px;
    object-fit:contain;
}

.report-header h2{
    margin:15px 0 10px;
    color:#333;
}

.report-header p{
    color:#777;
}

.report-filter-card{
    background:#fff;
    border-radius:20px;
    padding:25px;
    margin-bottom:25px;
    box-shadow:0 5px 15px rgba(0,0,0,.08);
}

.report-filter{
    display:flex;
    gap:20px;
    align-items:end;
    flex-wrap:wrap;
}

.filter-group{
    flex:1;
    min-width:200px;
}

.filter-group label{
    display:block;
    margin-bottom:8px;
    font-weight:600;
}

.report-btn{
    background:#ff9800;
    color:#fff;
    border:none;
    padding:14px 25px;
    border-radius:12px;
    cursor:pointer;
    font-weight:bold;
}

.report-btn:hover{
    background:#f57c00;
}

.report-summary{
    display:flex;
    gap:20px;
    margin-bottom:25px;
    flex-wrap:wrap;
}

.summary-card{
    flex:1;
    min-width:250px;
    background:#fff;
    border-radius:18px;
    padding:20px;
    box-shadow:0 4px 12px rgba(0,0,0,.08);
    display:flex;
    align-items:center;
    gap:15px;
}

.summary-icon{
    font-size:40px;
}

.summary-title{
    color:#888;
    font-size:14px;
}

.summary-number{
    font-size:28px;
    font-weight:bold;
    color:#ff9800;
}

.summary-text{
    font-size:18px;
    font-weight:600;
}

@media(max-width:768px){

    .report-filter{
        flex-direction:column;
    }

    .filter-group{
        width:100%;
    }

    .report-btn{
        width:100%;
    }

    .summary-card{
        min-width:100%;
    }
}


.status-column{
    text-align:center;
    vertical-align:middle;
}

.status-column .status-btn{
    display:block;
    margin:auto;
}