/* =========================================================
   DigiSoft Link - Responsive Global Styles
   File: assets/css/app.css
   Compatible with desktop, tablet, mobile, Laragon and hosting
========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    width: 100%;
    min-width: 320px;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: #f5f7fb;
    color: #172033;
    line-height: 1.6;
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

a {
    overflow-wrap: anywhere;
}

button,
input,
select,
textarea {
    max-width: 100%;
    font: inherit;
}

button,
.btn {
    touch-action: manipulation;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
    overflow-wrap: break-word;
}

h1,
h2,
h3,
h4 {
    line-height: 1.3;
}

/* =========================
   Navigation / Header
========================= */

.nav {
    width: 100%;
    min-height: 70px;
    background: #101827;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 5%;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 20px;
}

.brand img {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
}

.brand span {
    overflow-wrap: anywhere;
}

.nav nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px 18px;
    min-width: 0;
}

.nav nav a {
    color: #dbeafe;
    text-decoration: none;
    padding: 7px 3px;
    transition: color .2s ease;
}

.nav nav a:hover,
.nav nav a:focus {
    color: #fff;
}

/* =========================
   Hero Section
========================= */

.hero {
    width: 100%;
    min-height: 320px;
    height: auto;
    display: flex;
    align-items: center;
    padding: clamp(28px, 5vw, 60px) 7%;
    background: linear-gradient(120deg, #0f172a, #2563eb);
    color: #fff;
}

.hero > *,
.hero .container {
    min-width: 0;
}

.hero h1 {
    font-size: clamp(30px, 5vw, 64px);
    margin: 0 0 12px;
    line-height: 1.15;
}

.hero p {
    max-width: 760px;
    font-size: clamp(15px, 2vw, 19px);
}

.hero img {
    max-width: 100%;
    height: auto;
}

/* =========================
   Main Container
========================= */

.container {
    width: min(1180px, 92%);
    max-width: 100%;
    margin: 35px auto;
    min-width: 0;
}

section {
    min-width: 0;
    max-width: 100%;
}

.section-title {
    margin-bottom: 22px;
}

/* =========================
   Responsive Grid
========================= */

.grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(250px, 100%), 1fr)
    );
    gap: 20px;
    min-width: 0;
}

.card {
    min-width: 0;
    max-width: 100%;
    background: #fff;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 8px 30px #0f172a12;
    overflow-wrap: anywhere;
}

.card img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 12px;
}

.card h2,
.card h3,
.card h4 {
    overflow-wrap: anywhere;
}

.card > *:first-child {
    margin-top: 0;
}

/* =========================
   Buttons
========================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 100%;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 9px;
    background: #2563eb;
    color: #fff;
    text-decoration: none;
    text-align: center;
    border: 0;
    cursor: pointer;
    overflow-wrap: anywhere;
    transition: background .2s ease, transform .2s ease;
}

.btn:hover {
    background: #1d4ed8;
}

.btn:active {
    transform: translateY(1px);
}

.btn.green {
    background: #16a34a;
}

.btn.green:hover {
    background: #15803d;
}

.btn.red {
    background: #dc2626;
}

.btn.red:hover {
    background: #b91c1c;
}

/* =========================
   Forms
========================= */

.input {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 11px;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    margin: 5px 0 14px;
    background: #fff;
    color: #172033;
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #93c5fd;
    outline-offset: 1px;
}

textarea {
    width: 100%;
    min-height: 100px;
    resize: vertical;
}

select,
input[type="date"],
input[type="file"] {
    max-width: 100%;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.form-grid > * {
    min-width: 0;
}

/* =========================
   Alerts
========================= */

.alert {
    width: 100%;
    max-width: 100%;
    padding: 12px 15px;
    border-radius: 9px;
    background: #e0f2fe;
    margin: 12px 0;
    overflow-wrap: anywhere;
}

/* =========================
   Footer
========================= */

.footer {
    width: 100%;
    padding: 30px 5%;
    text-align: center;
    background: #101827;
    color: #cbd5e1;
    margin-top: 50px;
    overflow-wrap: anywhere;
}

/* =========================
   Tables
   Scroll horizontally on small screens
========================= */

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table th,
.table td {
    padding: 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

/* Optional wrapper around wide tables */
.table-responsive {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}

.table-responsive .table {
    min-width: 600px;
}

.table th {
    white-space: nowrap;
}

/* =========================
   Image Slider
========================= */

.slider {
    width: 100%;
    height: clamp(220px, 38vw, 400px);
    min-height: 220px;
    position: relative;
    overflow: hidden;
    background: #111;
}

.slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .7s ease;
}

.slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

.slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide .caption {
    position: absolute;
    inset: auto 8% 30px;
    max-width: 84%;
    color: #fff;
    text-shadow: 0 2px 8px #000;
    overflow-wrap: anywhere;
}

.slide .caption h1,
.slide .caption h2,
.slide .caption h3 {
    font-size: clamp(22px, 4vw, 42px);
    margin: 0 0 10px;
}

.slide .caption p {
    font-size: clamp(14px, 2vw, 18px);
}

/* =========================
   Client Logos
========================= */

.client {
    min-width: 0;
    text-align: center;
}

.client img {
    display: block;
    width: auto;
    height: 70px;
    max-width: min(160px, 100%);
    margin: 0 auto;
    object-fit: contain;
}

/* =========================
   Admin Layout
========================= */

.admin {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: 100vh;
}

.side {
    flex: 0 0 230px;
    width: 230px;
    min-width: 0;
    background: #111827;
    color: #fff;
    padding: 20px;
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 900;
}

.side a {
    display: block;
    color: #cbd5e1;
    padding: 10px;
    margin-bottom: 3px;
    text-decoration: none;
    border-radius: 8px;
    overflow-wrap: anywhere;
}

.side a:hover,
.side a:focus {
    background: #1f2937;
    color: #fff;
}

.content {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 230px;
    width: calc(100% - 230px);
    max-width: calc(100% - 230px);
    padding: 25px;
    overflow-wrap: anywhere;
}

.content img {
    max-width: 100%;
    height: auto;
}

.content table {
    max-width: 100%;
}

.stats {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(180px, 100%), 1fr)
    );
    gap: 15px;
}

.stat {
    min-width: 0;
    background: #fff;
    padding: 20px;
    border-radius: 14px;
    overflow-wrap: anywhere;
}

/* =========================
   Medium Screens / Tablets
========================= */

@media (max-width: 1024px) {
    .nav {
        padding-left: 3%;
        padding-right: 3%;
    }

    .content {
        padding: 20px;
    }

    .card {
        padding: 18px;
    }

    .grid {
        gap: 16px;
    }
}

/* =========================
   Mobile and Small Tablets
========================= */

@media (max-width: 800px) {
    .nav {
        position: relative;
        height: auto;
        min-height: 0;
        padding: 14px 4%;
        gap: 12px;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .brand {
        font-size: 18px;
    }

    .brand img {
        width: 38px;
        height: 38px;
    }

    .nav nav {
        width: 100%;
        justify-content: flex-start;
        gap: 6px 14px;
    }

    .nav nav a {
        padding: 6px 0;
        font-size: 14px;
    }

    .hero {
        min-height: 260px;
        padding: 30px 5%;
    }

    .hero h1 {
        font-size: clamp(28px, 7vw, 42px);
    }

    .container {
        width: 94%;
        margin: 25px auto;
    }

    .grid {
        grid-template-columns: repeat(
            auto-fit,
            minmax(min(220px, 100%), 1fr)
        );
        gap: 14px;
    }

    .slider {
        height: clamp(220px, 48vw, 320px);
        min-height: 220px;
    }

    .slide .caption {
        inset: auto 5% 20px;
        max-width: 90%;
    }

    .side {
        position: relative;
        inset: auto;
        width: 100%;
        height: auto;
        min-height: 0;
        max-height: none;
        overflow: visible;
        padding: 12px;
        flex: none;
    }

    .admin {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    .side a {
        display: inline-block;
        margin: 3px;
        padding: 8px 10px;
    }

    .content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
        padding: 16px;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .stats {
        grid-template-columns: repeat(
            auto-fit,
            minmax(min(150px, 100%), 1fr)
        );
    }

    .footer {
        padding: 25px 4%;
    }
}

/* =========================
   Small Mobile Phones
========================= */

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .nav {
        padding: 12px;
    }

    .brand {
        font-size: 17px;
        gap: 8px;
    }

    .brand img {
        width: 34px;
        height: 34px;
    }

    .nav nav {
        gap: 5px 12px;
    }

    .nav nav a {
        font-size: 13px;
    }

    .hero {
        min-height: 230px;
        padding: 25px 16px;
    }

    .hero h1 {
        font-size: clamp(26px, 8vw, 34px);
    }

    .container {
        width: calc(100% - 24px);
        margin: 20px auto;
    }

    .grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .card {
        padding: 15px;
        border-radius: 12px;
    }

    .card img {
        height: 170px;
    }

    .btn {
        min-height: 40px;
        padding: 9px 12px;
    }

    .slider {
        height: 230px;
        min-height: 230px;
    }

    .slide .caption {
        inset: auto 14px 15px;
        max-width: calc(100% - 28px);
    }

    .slide .caption h1,
    .slide .caption h2,
    .slide .caption h3 {
        font-size: 23px;
    }

    .content {
        padding: 12px;
    }

    .side {
        padding: 10px;
    }

    .side a {
        padding: 7px 9px;
        font-size: 13px;
    }

    .stat {
        padding: 15px;
    }

    .table th,
    .table td {
        padding: 8px;
        font-size: 13px;
    }

    .input {
        font-size: 16px;
    }
}

/* =========================
   Accessibility
========================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}