/* ============================================================
   MyShopDesk — common.css
   MOBILE-FIRST RESPONSIVE VERSION
   Original styles intact + full mobile enhancements
   ============================================================ */

*{
    box-sizing:border-box;
    font-family:'Segoe UI',sans-serif;
}

body{
    margin:0;
    background:linear-gradient(135deg,#0f2027,#203a43,#2c5364);
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
}

/* ===== LOGIN / REGISTER CARD ===== */
.card{
    background:#fff;
    width:100%;
    max-width:420px;
    padding:30px;
    border-radius:14px;
    box-shadow:0 20px 40px rgba(0,0,0,0.25);
}

.logo{
    text-align:center;
    margin-bottom:20px;
}

.logo img{
    width:300px;
    max-width:100%;
    margin-bottom:20px;
}

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

.form-group{
    margin-bottom:15px;
}

.form-group label{
    font-size:14px;
    color:#444;
}

.form-group input{
    width:100%;
    padding:12px;
    border-radius:8px;
    border:1px solid #ccc;
    margin-top:6px;
    font-size:15px;
}

.btn{
    width:100%;
    background:#ff7a18;
    background:linear-gradient(135deg,#ff7a18,#ffb347);
    border:none;
    padding:12px;
    color:#fff;
    font-size:16px;
    border-radius:10px;
    cursor:pointer;
    margin-top:10px;
}

.btn:hover{
    opacity:0.9;
}

.link{
    text-align:center;
    margin-top:15px;
}

.link a{
    text-decoration:none;
    color:#ff7a18;
    font-weight:600;
}

.msg{
    text-align:center;
    margin-bottom:15px;
    color:red;
}
.success{
    color:green;
}

/* ===== APP LAYOUT ===== */
.app{
    display:flex;
    min-height:100vh;
    width:100%;
    align-items:stretch;
    justify-content:flex-start;
}

/* ===== SIDEBAR ===== */
.sidebar{
    width:240px;
    min-height:100vh;
    background:linear-gradient(180deg,#0f2027,#203a43,#2c5364);
    color:#fff;
    position:fixed;
    left:0;
    top:0;
    overflow-y:auto;
    max-height:100vh;
    box-shadow:2px 0 10px rgba(0,0,0,0.3);
    z-index:9999;
    transition:left 0.3s ease;
}

.sidebar::-webkit-scrollbar{ width:4px; }
.sidebar::-webkit-scrollbar-thumb{ background:#475569; border-radius:8px; }
.sidebar::-webkit-scrollbar-track{ background:transparent; }

/* ===== BRAND ===== */
.brand{
    text-align:center;
    padding:22px 15px;
    border-bottom:1px solid rgba(255,255,255,0.15);
}

.brand img{
    width:160px;
    margin-bottom:10px;
    filter:drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.brand h3{
    margin:0;
    font-size:18px;
    letter-spacing:1px;
    color:#fff;
}

.brand .shop-name{
    font-size:13px;
    color:#e0f2fe;
    margin-top:4px;
}

.brand .divider{
    width:240px;
    height:2px;
    margin:10px auto;
    background:linear-gradient(90deg,transparent,#00c6ff,transparent);
}

/* ===== NAV ===== */
.nav{
    list-style:none;
    padding:0;
    margin:0;
}

.nav li{
    border-bottom:1px solid rgba(255,255,255,0.08);
}

.nav li a{
    display:block;
    padding:12px 18px;
    color:#e5e7eb;
    text-decoration:none;
    font-size:14px;
    transition:0.2s;
}

.nav li a:hover{
    background:#ff7a18;
    color:#fff;
}

.nav li a.active{
    background:#ff7a18;
    color:#fff;
}

/* ===== SUBMENU ===== */
.submenu{
    display:none;
    background:#111827;
    list-style:none;
    padding:0;
    margin:0;
}

.submenu li{
    border-bottom:1px solid rgba(255,255,255,0.04);
}

.submenu li a{
    padding-left:35px;
    font-size:13px;
    color:#cbd5e1;
}

.submenu li a:hover{
    background:#ff7a18;
    color:#fff;
    padding-left:35px;
}

.nav-group > a{
    font-weight:600;
    cursor:pointer;
}

/* ===== MAIN ===== */
.main{
    margin-left:240px;
    flex:1;
    background:#f1f5f9;
    overflow-y:auto;
    max-height:100vh;
    min-height:100vh;
    /* Desktop: sidebar fixed, main scrolls independently */
    position:relative;
}

/* ===== HEADER ===== */
.header{
    background:#fff;
    padding:15px 20px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    box-shadow:0 4px 10px rgba(0,0,0,0.05);
    position:sticky;
    top:0;
    z-index:100;
}

.header h1{
    font-size:20px;
    margin:0;
}

.logout{
    background:#ef4444;
    color:#fff;
    padding:8px 14px;
    border-radius:8px;
    text-decoration:none;
    font-size:14px;
}

/* ===== DASHBOARD CARDS ===== */
.cards{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
    gap:16px;
    padding:20px;
}

.card-box{
    background:#fff;
    padding:20px;
    border-radius:14px;
    box-shadow:0 10px 20px rgba(0,0,0,0.08);
}

.card-box h3{
    margin:0;
    font-size:14px;
    color:#64748b;
}

.card-box p{
    font-size:26px;
    margin:8px 0 0;
    font-weight:bold;
}

/* ===== TABLE ===== */
.table-wrapper{
    padding:16px 20px;
    /* MOBILE FIX: allow horizontal scroll for wide tables */
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
}

.table{
    width:100%;
    border-collapse:collapse;
    background:#fff;
    border-radius:12px;
    overflow:hidden;
    box-shadow:0 10px 20px rgba(0,0,0,0.08);
    min-width:500px; /* prevents collapse on mobile */
}

.table th{
    background:#1f2933;
    color:#fff;
    padding:12px;
    font-size:13px;
    text-align:left;
    white-space:nowrap;
}

.table td{
    padding:11px 12px;
    border-bottom:1px solid #e5e7eb;
    font-size:13px;
}

.table tr:hover{
    background:#f9fafb;
}

/* ===== STATUS BADGES ===== */
.badge{
    padding:4px 10px;
    border-radius:20px;
    font-size:12px;
    font-weight:600;
}

.badge-trial{
    background:#fde68a;
    color:#92400e;
}

.badge-active{
    background:#bbf7d0;
    color:#166534;
}

.badge-expired{
    background:#fecaca;
    color:#991b1b;
}

/* ===== FORM SYSTEM ===== */
.form-wrapper{
    background:#fff;
    padding:20px;
    margin:16px 20px;
    border-radius:14px;
    box-shadow:0 10px 20px rgba(0,0,0,0.08);
}

.form-title{
    font-size:18px;
    margin-bottom:20px;
}

.form-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
    gap:14px;
}

.form-group{
    margin-bottom:14px;
}

.form-group label{
    display:block;
    font-weight:600;
    margin-bottom:5px;
    color:#333;
    font-size:14px;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="tel"],
select,
textarea{
    width:100%;
    padding:10px 12px;
    border:1px solid #ccc;
    border-radius:8px;
    font-size:14px;
    outline:none;
    transition:0.2s;
    background:#fff;
    /* Mobile: prevent zoom on focus (iOS) */
    font-size:16px;
}

input:focus,
select:focus,
textarea:focus{
    border-color:#ff7a18;
    box-shadow:0 0 0 2px rgba(255,122,24,0.15);
}

::placeholder{ color:#999; }

button,
.btn{
    background:#ff7a18;
    border:none;
    padding:10px 16px;
    color:#fff;
    font-size:14px;
    border-radius:8px;
    cursor:pointer;
    transition:0.2s;
    touch-action:manipulation; /* faster tap on mobile */
}

button:hover,
.btn:hover{ opacity:0.88; }

.btn-small{
    padding:6px 12px;
    font-size:12px;
    border-radius:6px;
}

.btn-edit{ background:#22c55e; }
.btn-edit:hover{ background:#16a34a; }

.btn-delete{ background:#dc3545; }
.btn-delete:hover{ background:#bd2130; }

.form-inline{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
}

.form-inline input,
.form-inline select{
    flex:1;
    min-width:160px;
}

/* ===== POS BILLING ===== */
.pos-container{
    padding:16px 18px;
}

.pos-grid{
    display:grid;
    grid-template-columns:2fr 1fr;
    gap:16px;
}

.pos-box{
    background:#fff;
    padding:18px;
    border-radius:14px;
    box-shadow:0 10px 20px rgba(0,0,0,0.08);
    margin-bottom:14px;
}

.pos-box h3{
    margin-top:0;
}

/* POS items — scrollable on mobile */
.pos-items-scroll{
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
}

.total-box{
    font-size:20px;
    font-weight:bold;
    margin-top:15px;
}

.btn-add{
    background:#22c55e;
    color:#fff;
    border:none;
    padding:10px 16px;
    border-radius:8px;
    cursor:pointer;
    font-size:14px;
    touch-action:manipulation;
}

.btn-remove{
    background:#ef4444;
    color:#fff;
    border:none;
    padding:8px 10px;
    border-radius:6px;
    cursor:pointer;
    touch-action:manipulation;
}

/* ===== INVOICE ===== */
.invoice-box{
    max-width:800px;
    margin:auto;
    background:#fff;
    padding:20px;
    font-size:14px;
}

.invoice-box table{
    width:100%;
    border-collapse:collapse;
}

.invoice-box th,
.invoice-box td{
    border:1px solid #ccc;
    padding:8px;
    text-align:left;
}

.invoice-header{ text-align:center; margin-bottom:15px; }
.invoice-header img{ max-height:80px; margin-bottom:6px; }
.invoice-header h2{ margin:3px 0; }
.invoice-header .address{ font-size:13px; margin-bottom:3px; }
.invoice-header .mobile{ font-size:13px; margin-bottom:5px; }
.invoice-header .customer{ font-size:14px; font-weight:600; }

.summary-table{ width:300px; float:right; margin-top:10px; border-collapse:collapse; }
.summary-table td{ padding:5px; }

@media print{ button{ display:none; } }

/* ===== MOBILE TOGGLE ===== */
.menu-toggle{
    position:fixed;
    top:12px;
    left:12px;
    background:#1f2933;
    color:#fff;
    padding:10px 14px;
    border-radius:8px;
    z-index:99999;
    font-size:20px;
    cursor:pointer;
    display:none;
    border:none;
    line-height:1;
    touch-action:manipulation;
}

.overlay{
    display:none;
    position:fixed;
    top:0; left:0;
    width:100%; height:100%;
    background:rgba(0,0,0,0.5);
    z-index:9998;
}

/* ===================================================
   MOBILE RESPONSIVE — 768px and below
   =================================================== */
@media(max-width:768px){

    /* Sidebar hidden by default, toggled via JS */
    .menu-toggle{ display:block; }

    .sidebar{
        left:-240px;
        width:240px !important;
        position:fixed !important;
        top:0 !important;
        height:100vh !important;
        background:linear-gradient(180deg,#0f2027,#203a43,#2c5364) !important;
        z-index:9999 !important;
        overflow-y:auto !important;
        transition:left 0.3s ease !important;
        display:block !important;
    }

    .sidebar.show{
        left:0 !important;
    }

    .overlay.show{ display:block; }

    /* Main — full width, body handles scroll on mobile */
    .main{
        margin-left:0 !important;
        max-height:none !important;
        height:auto !important;
        overflow:visible !important;
        min-height:100vh;
    }

    /* Body scroll unlock */
    body{
        overflow-y:auto !important;
        height:auto !important;
    }

    .app{
        display:block !important;
        height:auto !important;
        min-height:100vh;
    }

    /* Header — mobile pe static (no sticky) taaki content clip na ho */
    .header{
        padding:12px 14px 12px 60px !important;
        position:static !important;
    }

    .header h1{ font-size:16px; }

    /* Cards — 2 columns on mobile */
    .cards{
        grid-template-columns:1fr 1fr;
        gap:10px;
        padding:10px 12px;
    }

    .card-box{ padding:14px; }
    .card-box p{ font-size:22px; }

    /* Form wrapper */
    .form-wrapper{
        margin:10px 12px;
        padding:14px;
    }

    .form-grid{
        grid-template-columns:1fr;
    }

    /* Table — horizontal scroll */
    .table-wrapper{
        padding:10px 12px;
        overflow-x:auto;
        -webkit-overflow-scrolling:touch;
    }

    .table th, .table td{
        padding:9px 10px;
        font-size:12px;
    }

    /* POS — stack layout on mobile */
    .pos-grid{
        grid-template-columns:1fr !important;
    }

    .pos-container{
        padding:10px 12px;
    }

    .pos-box{
        padding:14px;
        margin-bottom:10px;
    }

    /* Invoice on mobile */
    .invoice-box{
        padding:12px;
        font-size:12px;
    }

    .summary-table{
        width:100%;
        float:none;
        margin-top:10px;
    }
}

/* ===================================================
   SMALL MOBILE — 480px
   =================================================== */
@media(max-width:480px){

    .cards{
        grid-template-columns:1fr 1fr;
        gap:8px;
        padding:8px 10px;
    }

    .card-box{ padding:12px; }
    .card-box h3{ font-size:12px; }
    .card-box p{ font-size:20px; }

    .header{ padding:10px 12px 10px 56px; }
    .header h1{ font-size:14px; }

    .btn, button{
        padding:10px 14px;
        font-size:14px;
    }

    .table th, .table td{
        font-size:11px;
        padding:8px 8px;
    }

    .form-wrapper{
        margin:8px 10px;
        padding:12px;
    }

    input[type="text"],
    input[type="number"],
    input[type="password"],
    input[type="email"],
    input[type="date"],
    input[type="tel"],
    select,
    textarea{
        padding:10px;
        font-size:16px; /* prevents iOS zoom */
    }
}


/* ════ GLOBAL TABLE MOBILE SCROLL ════ */
@media(max-width:768px){
    .table-wrapper,
    .main .card,
    .main .dc,
    .main .pos-box{
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    /* All tables get min-width so they scroll rather than squeeze */
    .main table,
    .content table,
    .pos-box table,
    .card table{
        min-width: 480px;
    }
    /* Wrapper div for tables */
    .t-scroll{
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
    }
}
