/* CheckTV Portal - Frontend CSS */
:root{
    --bg:#09090b;
    --surface:#18181b;
    --surface-2:#27272a;
    --border:#3f3f46;
    --text:#fafafa;
    --text-muted:#a1a1aa;
    --primary:#a855f7;
    --primary-dark:#7c3aed;
    --success:#22c55e;
    --warning:#f59e0b;
    --danger:#ef4444;
}

*{margin:0;padding:0;box-sizing:border-box}
body{
    font-family:'Inter',-apple-system,BlinkMacSystemFont,sans-serif;
    background:var(--bg);
    color:var(--text);
    line-height:1.5;
    -webkit-tap-highlight-color:transparent;
}

/* App Layout */
.app-layout{
    display:flex;
    min-height:100vh;
}

/* Sidebar */
.sidebar{
    width:260px;
    background:var(--surface);
    border-right:1px solid var(--border);
    display:flex;
    flex-direction:column;
    position:fixed;
    top:0;
    left:0;
    bottom:0;
    z-index:100;
}

.sidebar-header{
    padding:24px 20px;
    border-bottom:1px solid var(--border);
    display:flex;
    align-items:center;
    gap:12px;
}

.sidebar-logo{
    font-size:32px;
}

.sidebar-brand{
    display:flex;
    flex-direction:column;
}

.brand-name{
    font-size:18px;
    font-weight:700;
}

.brand-sub{
    font-size:12px;
    color:var(--text-muted);
}

.sidebar-nav{
    flex:1;
    padding:16px 12px;
    overflow-y:auto;
    display:flex;
    flex-direction:column;
    gap:4px;
}

.nav-item{
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 16px;
    border-radius:10px;
    color:var(--text-muted);
    text-decoration:none;
    font-size:14px;
    font-weight:500;
    transition:all 0.15s;
}

.nav-item:hover{
    background:var(--surface-2);
    color:var(--text);
}

.nav-item.active{
    background:linear-gradient(135deg,var(--primary),var(--primary-dark));
    color:#fff;
}

.nav-icon{
    font-size:18px;
    width:24px;
    text-align:center;
}

.nav-label{
    flex:1;
}

.nav-badge{
    background:var(--danger);
    color:#fff;
    font-size:11px;
    font-weight:600;
    padding:2px 8px;
    border-radius:10px;
    min-width:20px;
    text-align:center;
}

.sidebar-footer{
    padding:16px 12px;
    border-top:1px solid var(--border);
}

/* Main Content */
.main-content{
    flex:1;
    margin-left:260px;
    min-height:100vh;
    display:flex;
    flex-direction:column;
}

.content-header{
    padding:24px 32px;
    border-bottom:1px solid var(--border);
    background:var(--surface);
}

.page-title{
    font-size:24px;
    font-weight:700;
}

.page-subtitle{
    color:var(--text-muted);
    font-size:14px;
    margin-top:4px;
}

.content-body{
    padding:32px;
    flex:1;
}

/* Glass Card */
.glass{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:16px;
    padding:24px;
    margin-bottom:24px;
}

.glass-title{
    font-size:16px;
    font-weight:600;
    display:flex;
    align-items:center;
    gap:8px;
}

.glass-icon{font-size:20px}

/* Forms */
.form-group{margin-bottom:20px}
.form-label{
    display:block;
    font-size:14px;
    font-weight:500;
    margin-bottom:8px;
    color:var(--text);
}
.form-input,.form-select{
    width:100%;
    padding:12px 16px;
    background:var(--surface-2);
    border:1px solid var(--border);
    border-radius:10px;
    color:var(--text);
    font-size:14px;
    font-family:inherit;
    transition:border-color 0.15s;
}
.form-input:focus,.form-select:focus{
    outline:none;
    border-color:var(--primary);
}
.form-input::placeholder{color:var(--text-muted)}

.form-row{
    display:flex;
    gap:16px;
}
.form-row .form-group{flex:1}

/* Buttons */
.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:12px 24px;
    background:linear-gradient(135deg,var(--primary),var(--primary-dark));
    border:none;
    border-radius:10px;
    color:#fff;
    font-size:14px;
    font-weight:600;
    font-family:inherit;
    cursor:pointer;
    transition:opacity 0.15s,transform 0.15s;
    text-decoration:none;
}
.btn:hover{opacity:0.9}
.btn:active{transform:scale(0.98)}

.btn-secondary{
    background:var(--surface-2);
    color:var(--text);
}
.btn-success{background:var(--success)}
.btn-warning{background:var(--warning);color:#000}
.btn-danger{background:var(--danger)}

.btn-sm{padding:8px 14px;font-size:13px;border-radius:8px}
.btn-full{width:100%}

.btn-group{display:flex;gap:8px;flex-wrap:wrap}

/* Badges */
.badge{
    display:inline-flex;
    padding:4px 10px;
    border-radius:6px;
    font-size:12px;
    font-weight:600;
}
.badge-success{background:rgba(34,197,94,0.15);color:var(--success)}
.badge-warning{background:rgba(245,158,11,0.15);color:var(--warning)}
.badge-danger{background:rgba(239,68,68,0.15);color:var(--danger)}
.badge-muted{background:var(--surface-2);color:var(--text-muted)}

/* Tables */
.table-wrap{overflow-x:auto}
.data-table{
    width:100%;
    border-collapse:collapse;
}
.data-table th,.data-table td{
    padding:14px 16px;
    text-align:left;
    border-bottom:1px solid var(--border);
}
.data-table th{
    font-size:12px;
    font-weight:600;
    text-transform:uppercase;
    color:var(--text-muted);
    background:var(--surface-2);
}
.data-table tr:last-child td{border-bottom:none}
.data-table tr:hover td{background:rgba(255,255,255,0.02)}

/* Modal */
.modal{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.8);
    z-index:1000;
    align-items:center;
    justify-content:center;
    padding:20px;
}
.modal.open{display:flex}

.modal-box{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:16px;
    width:100%;
    max-width:500px;
    max-height:90vh;
    overflow-y:auto;
}

.modal-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:20px 24px;
    border-bottom:1px solid var(--border);
}

.modal-title{font-size:18px;font-weight:600}

.modal-close{
    background:none;
    border:none;
    color:var(--text-muted);
    font-size:24px;
    cursor:pointer;
    padding:4px;
    line-height:1;
}
.modal-close:hover{color:var(--text)}

.modal-body{padding:24px}
.modal-footer{
    display:flex;
    gap:12px;
    justify-content:flex-end;
    padding:16px 24px;
    border-top:1px solid var(--border);
}

/* Chat */
.chat-messages{
    height:400px;
    overflow-y:auto;
    padding:20px;
    display:flex;
    flex-direction:column;
    gap:12px;
    background:var(--bg);
    border-radius:12px;
}

.chat-msg{
    max-width:80%;
    padding:12px 16px;
    border-radius:16px;
}

.chat-msg.incoming{
    background:var(--surface-2);
    align-self:flex-start;
    border-bottom-left-radius:4px;
}

.chat-msg.outgoing{
    background:linear-gradient(135deg,var(--primary),var(--primary-dark));
    align-self:flex-end;
    border-bottom-right-radius:4px;
}

.chat-msg-sender{
    font-size:11px;
    font-weight:600;
    margin-bottom:4px;
    opacity:0.7;
}

.chat-msg-text{font-size:14px;line-height:1.4}

.chat-msg-time{
    font-size:11px;
    opacity:0.6;
    margin-top:4px;
}

.chat-form{
    display:flex;
    gap:12px;
    padding:16px;
    background:var(--surface);
    border-radius:12px;
    margin-top:16px;
}

.chat-form .form-input{flex:1;margin:0}

/* Form Messages */
.form-msg{
    margin-top:16px;
    padding:12px 16px;
    border-radius:10px;
    font-size:14px;
    display:none;
}
.form-msg.success{
    display:block;
    background:rgba(34,197,94,0.1);
    border:1px solid rgba(34,197,94,0.2);
    color:#86efac;
}
.form-msg.error{
    display:block;
    background:rgba(239,68,68,0.1);
    border:1px solid rgba(239,68,68,0.2);
    color:#fca5a5;
}

/* Utilities */
.text-center{text-align:center}
.text-muted{color:var(--text-muted)}
.text-sm{font-size:13px}
.mt-1{margin-top:8px}
.mt-2{margin-top:16px}
.mt-3{margin-top:24px}
.mb-1{margin-bottom:8px}
.mb-2{margin-bottom:16px}
.mb-3{margin-bottom:24px}

/* Alert */
.alert{
    padding:16px 20px;
    border-radius:12px;
    margin-bottom:20px;
}
.alert-warning{
    background:rgba(245,158,11,0.1);
    border:1px solid rgba(245,158,11,0.3);
    color:#fbbf24;
}

/* Customer Table Styles */
.td-customer{
    border-right:1px solid var(--border);
    min-width:200px;
}

.customer-actions-small{
    display:flex;
    gap:6px;
    margin-top:8px;
}

.btn-icon{
    background:none;
    border:none;
    padding:4px 8px;
    cursor:pointer;
    font-size:14px;
    border-radius:6px;
    transition:background 0.15s;
}
.btn-icon:hover{background:var(--surface-2)}
.btn-icon.btn-danger:hover{background:rgba(239,68,68,0.15)}

.account-type{
    display:inline-block;
    padding:4px 10px;
    border-radius:6px;
    font-size:12px;
    font-weight:600;
}
.account-type.main{background:rgba(168,85,247,0.15);color:var(--primary)}
.account-type.sub{background:var(--surface-2);color:var(--text-muted)}

.credentials{
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}
.credentials code{
    background:var(--surface-2);
    padding:4px 10px;
    border-radius:6px;
    font-size:13px;
}

.row-pending{background:rgba(245,158,11,0.05)}
.row-sub td{border-top:1px dashed var(--border)}

/* Mobile */
@media(max-width:900px){
    .sidebar{
        position:fixed;
        left:-260px;
        transition:left 0.3s;
    }
    .sidebar.open{left:0}
    
    .main-content{
        margin-left:0;
    }
    
    .content-header{
        padding:16px 20px;
    }
    
    .content-body{
        padding:20px;
    }
}

@media(max-width:600px){
    .form-row{
        flex-direction:column;
        gap:0;
    }
    
    .btn-group{
        flex-direction:column;
    }
    
    .data-table th,
    .data-table td{
        padding:10px 12px;
        font-size:13px;
    }
}
