/* ===== ClockWork Widget Styles ===== */
/* Matches old Employee Portal ClockWork modal design */
/* All classes prefixed cw- to avoid host page conflicts */

/* ----- CSP-safe utility classes (no inline styles needed) ----- */
.cw-hidden { display: none !important; }
.cw-visible { display: block !important; }
.cw-disabled { opacity: 0.65; cursor: not-allowed; }
.cw-enabled { opacity: 1; cursor: pointer; }

/* ----- Button Colors: applied dynamically via nonce-aware <style> element (CSP-safe) ----- */
/* See applyButtonColors() in clock-widget.js — supports any DB-configurable hex color */

/* ----- Floating Button (matches old .btn-float) ----- */
.cw-float-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background-color: rgba(44, 104, 138, 0.5);
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    cursor: pointer;
    box-shadow: inset 1px 6px 12px rgba(67, 142, 185, 0.5),
                inset -1px -10px 5px rgba(44, 104, 138, 0.5);
    border: none;
    padding: 0;
}
.cw-float-btn:hover {
    background-color: rgba(44, 104, 138, 0.7);
}
/* Inner clock icon — matches old .clock { position:absolute; line-height:55px; font-size:35px } */
.cw-float-clock {
    color: #fff;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 0;
    margin: 0;
    line-height: 55px;
    font-size: 35px;
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    transition: all 0.3s;
}
/* Shake animation — matches old .shake { animation: ringing 2s 9999999 ease 1s } */
.cw-float-shake {
    display: inline-block;
    animation: cwShake 2.0s ease 1.0s infinite;
    transform-origin: 50% 0%;
}

/* ----- Modal Overlay (acts as backdrop + scroll container, like Bootstrap) ----- */
.cw-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.5);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.cw-modal.active {
    display: block;
}

/* ----- Modal Dialog (matches old #modalOTE .modal-sm) ----- */
.cw-modal-dialog {
    position: relative;
    margin: 30px auto;
    max-width: 450px;
    animation: cwFadeIn 0.3s ease-out;
}
.cw-modal-content {
    background: #fff;
    border: none;
    border-radius: 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* ----- Modal Header (matches old #438eb9 blue) ----- */
.cw-modal-header {
    text-align: center;
    padding: 10px 15px;
    background-color: #438eb9;
    color: #fff;
    position: relative;
}
.cw-modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 300;
    font-style: normal;
    color: #fff;
}
.cw-modal-header h3 strong {
    font-weight: 700;
}
/* Close button: matches Bootstrap .close + .white from old system */
.cw-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: #fff !important;
    font-size: 21px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 1;
    text-shadow: none;
}
.cw-modal-close:hover {
    opacity: 0.8;
}

/* ----- Modal Body ----- */
.cw-modal-body {
    padding: 15px;
}

/* ----- Clock Display ----- */
.cw-clock-display {
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    color: #333;
}
.cw-separator {
    margin: 10px 0;
    border: 0;
    border-top: 1px solid #e5e5e5;
}

/* ----- Inline Messages (matches old system exactly) ----- */
.cw-msg-success {
    text-align: center;
    margin-bottom: 10px;
    font-size: 13px;
    color: #347934;
    font-weight: bold;
    display: none;
}
.cw-msg-error {
    text-align: center;
    font-size: 13px;
    color: #af3f3c;
    font-weight: bold;
    margin-bottom: 10px;
    display: none;
}
.cw-msg-warning {
    text-align: center;
    font-size: 12px;
    color: #d2ab3d;
    font-weight: bold;
    margin-bottom: 10px;
    display: none;
}
.cw-msg-location {
    text-align: center;
    font-size: 13px;
    color: #af3f3c;
    font-weight: bold;
    margin-bottom: 10px;
    display: none;
}

/* ----- Form Fields (matches old no-radius input-group style) ----- */
.cw-form-group {
    margin-bottom: 10px;
}
.cw-input-group {
    display: flex;
    width: 100%;
}
.cw-input-addon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    background-color: #eee;
    border: 1px solid #ccc;
    border-right: none;
    border-radius: 0;
    color: #555;
}
.cw-input-addon svg {
    width: 16px;
    height: 16px;
}
.cw-form-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 0;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    height: 36px;
}
.cw-form-input:focus {
    border-color: #438eb9;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075),
                0 0 8px rgba(67, 142, 185, .6);
}
.cw-form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 0;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}
.cw-form-textarea:focus {
    border-color: #438eb9;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075),
                0 0 8px rgba(67, 142, 185, .6);
}

/* ----- Camera ----- */
.cw-camera-area {
    margin-bottom: 10px;
}
#cw-video,
#cw-photo {
    width: 100%;
    display: none;
}

/* ----- Button Group Headings (matches old btn-label-margin) ----- */
.cw-btn-group-heading {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    margin-top: 3px;
    margin-bottom: 4px;
}

/* ----- Action Buttons (matches old .btn-ote) ----- */
.cw-btn-row {
    display: flex;
    padding: 0 15px;
    position: relative;
}
/* Old form flat grid: stack pairs vertically instead of side-by-side columns */
.cw-btn-row-flat {
    flex-direction: column;
}
/* Left column: time/break/lunch buttons */
.cw-col-left {
    flex: 0 0 50%;
    max-width: 50%;
    padding-right: 10px;
}
.cw-col-left.cw-col-full-width {
    flex: 0 0 100%;
    max-width: 100%;
    padding-right: 0;
}
/* Right column: custom activity buttons + last punch */
.cw-col-right {
    flex: 0 0 50%;
    max-width: 50%;
    padding-left: 10px;
}
/* Vertical separator between columns (matches old .vl-separator) */
.cw-col-separator {
    border-left: 1px solid #ccc;
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
}
/* Full-width button row (Time In, Time Out) */
.cw-col-full {
    width: 100%;
    padding: 0;
}
/* Pair of side-by-side buttons (Break In/Out, Lunch In/Out) */
.cw-col-pair {
    display: flex;
    gap: 0;
}
.cw-col-half {
    flex: 0 0 50%;
    max-width: 50%;
}
.cw-col-half:first-child {
    padding-right: 2px;
}
.cw-col-half:last-child {
    padding-left: 2px;
}
.cw-btn-action {
    width: 100%;
    padding: 8px 4px;
    border: 1px solid transparent;
    border-radius: 0;
    font-size: 13px;
    font-weight: 400;
    color: #fff;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s;
    margin-bottom: 5px;
}
.cw-btn-action:hover:not(:disabled) {
    filter: brightness(0.85);
}
.cw-btn-action:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: visible;
}
.cw-btn-action:focus,
.cw-btn-action:active:focus {
    outline: none;
}

/* ----- Enable Out Button (matches old .btn-enableout + btn-warning) ----- */
.cw-btn-enable-out {
    width: 100%;
    border-radius: 0;
    border: 1px solid transparent;
    margin-bottom: 5px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 400;
    color: #fff;
    cursor: pointer;
    background-color: #f0ad4e;
}
.cw-btn-enable-out:focus,
.cw-btn-enable-out:active:focus {
    outline: none;
}
.cw-btn-enable-out:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: visible;
}
.cw-btn-enable-out-active {
    background-color: #5cb85c;
}

/* ----- Last Punch display (matches old #lblLastPunch) ----- */
.cw-last-punch {
    text-align: center;
    margin-top: 8px;
}
.cw-last-punch h6 {
    font-size: 14px;
    margin: 0;
}
.cw-last-punch-value {
    color: #347934;
}

/* ----- Animations ----- */
@keyframes cwShake {
    0%   { transform: rotate(-15deg); }
    2%   { transform: rotate(15deg); }
    4%   { transform: rotate(-18deg); }
    6%   { transform: rotate(18deg); }
    8%   { transform: rotate(-22deg); }
    10%  { transform: rotate(22deg); }
    12%  { transform: rotate(-18deg); }
    14%  { transform: rotate(18deg); }
    16%  { transform: rotate(-12deg); }
    18%  { transform: rotate(12deg); }
    20%  { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}
@keyframes cwFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    .cw-modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    .cw-btn-row {
        flex-direction: column;
    }
    .cw-col-left,
    .cw-col-left.cw-col-full-width,
    .cw-col-right {
        flex: 0 0 100%;
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
    .cw-col-separator {
        display: none;
    }
}

/* ----- Two-Step Flow: Continue Button ----- */
.cw-btn-continue {
    width: 100%;
    padding: 10px 16px;
    background: #438eb9;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background-color 0.2s;
}
.cw-btn-continue:hover:not(:disabled) {
    background: #367ba8;
}
.cw-btn-continue:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
