/* Tool: Crop Image - AKMods */
/* Design tokens & foundation loaded via HTML link tags:
 * - ../_shared/tokens.css
 * - ../_shared/base.css
 */

      .crop-preview-tabs {
        display: flex;
        gap: 6px;
        margin-bottom: 12px;
        background: var(--bg-surface-elevated, #1a202c);
        padding: 4px;
        border-radius: var(--radius-md, 8px);
        border: 1px solid var(--border-color, #273142);
        width: 100%;
      }
      .crop-preview-tab {
        flex: 1;
        background: transparent;
        border: none;
        color: var(--text-secondary, #94a3b8);
        padding: 8px 12px;
        border-radius: 6px;
        font-size: 0.82rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s ease;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
      }
      .crop-preview-tab:hover {
        color: var(--text-primary, #ffffff);
      }
      .crop-preview-tab.active {
        background: #0084ff;
        color: #ffffff;
        box-shadow: 0 2px 8px rgba(0, 132, 255, 0.35);
      }
      .cropper-stage {
        position: relative;
        width: 100%;
        height: 440px;
        max-height: 60vh;
        background-color: #0b0f17;
        background-image: 
          linear-gradient(45deg, #151b26 25%, transparent 25%),
          linear-gradient(-45deg, #151b26 25%, transparent 25%),
          linear-gradient(45deg, transparent 75%, #151b26 75%),
          linear-gradient(-45deg, transparent 75%, #151b26 75%);
        background-size: 20px 20px;
        background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
        border-radius: var(--radius-md, 8px);
        overflow: hidden;
        user-select: none;
        -webkit-user-select: none;
        touch-action: none;
        border: 1px solid var(--border-color, #273142);
        display: flex;
        align-items: center;
        justify-content: center;
      }
      .cropper-img-canvas {
        position: absolute;
        pointer-events: none;
        transform-origin: center center;
        max-width: none;
        max-height: none;
      }
      .crop-box {
        position: absolute;
        box-sizing: border-box;
        border: 2px solid #0084ff;
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65), 0 0 18px rgba(0, 132, 255, 0.35);
        cursor: move;
        touch-action: none;
        z-index: 10;
      }
      .crop-grid-h, .crop-grid-v {
        position: absolute;
        pointer-events: none;
        border: 0 dashed rgba(255, 255, 255, 0.35);
      }
      .crop-grid-h1 { top: 33.333%; left: 0; right: 0; border-top-width: 1px; }
      .crop-grid-h2 { top: 66.666%; left: 0; right: 0; border-top-width: 1px; }
      .crop-grid-v1 { left: 33.333%; top: 0; bottom: 0; border-left-width: 1px; }
      .crop-grid-v2 { left: 66.666%; top: 0; bottom: 0; border-left-width: 1px; }
      
      .crop-dim-badge {
        position: absolute;
        bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(11, 15, 23, 0.9);
        color: #f0f6fc;
        padding: 3px 8px;
        border-radius: 4px;
        font-size: 11px;
        font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        font-weight: 600;
        pointer-events: none;
        white-space: nowrap;
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
        z-index: 12;
      }
      
      /* 8 Grab Handles */
      .crop-handle {
        position: absolute;
        box-sizing: border-box;
        touch-action: none;
        z-index: 15;
      }
      .crop-handle::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 36px;
        height: 36px;
      }
      /* Corners */
      .crop-handle-corner {
        width: 13px;
        height: 13px;
        background: #ffffff;
        border: 2.5px solid #0084ff;
        border-radius: 2px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.5);
      }
      .handle-nw { top: -7px; left: -7px; cursor: nwse-resize; }
      .handle-ne { top: -7px; right: -7px; cursor: nesw-resize; }
      .handle-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
      .handle-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
      
      /* Edges */
      .crop-handle-edge-h {
        width: 22px;
        height: 7px;
        background: #0084ff;
        border: 1px solid #ffffff;
        border-radius: 3px;
        cursor: ns-resize;
      }
      .crop-handle-edge-v {
        width: 7px;
        height: 22px;
        background: #0084ff;
        border: 1px solid #ffffff;
        border-radius: 3px;
        cursor: ew-resize;
      }
      .handle-n { top: -4px; left: calc(50% - 11px); }
      .handle-s { bottom: -4px; left: calc(50% - 11px); }
      .handle-w { left: -4px; top: calc(50% - 11px); }
      .handle-e { right: -4px; top: calc(50% - 11px); }
      
      /* Controls Panel & Preset Grid */
      .ratio-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        margin-bottom: 12px;
      }
      @media (max-width: 640px) {
        .ratio-grid {
          grid-template-columns: repeat(3, 1fr);
        }
      }
      .ratio-btn {
        background: var(--bg-surface-elevated, #1a202c);
        border: 1px solid var(--border-color, #273142);
        color: var(--text-secondary, #94a3b8);
        padding: 8px 4px;
        border-radius: 6px;
        font-size: 0.78rem;
        font-weight: 600;
        cursor: pointer;
        text-align: center;
        transition: all 0.2s ease;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-height: 48px;
      }
      .ratio-btn:hover {
        color: #ffffff;
        border-color: #0084ff;
      }
      .ratio-btn.active {
        background: #0084ff;
        color: #ffffff;
        border-color: #0084ff;
        box-shadow: 0 2px 8px rgba(0, 132, 255, 0.4);
      }
      .ratio-btn .sub {
        font-size: 0.65rem;
        font-weight: 400;
        opacity: 0.8;
      }
      .transform-row {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        margin-bottom: 12px;
      }
      .tool-icon-btn {
        min-height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        font-size: 0.8rem;
        font-weight: 600;
        border-radius: 6px;
        background: var(--bg-surface-elevated, #1a202c);
        border: 1px solid var(--border-color, #273142);
        color: var(--text-secondary, #94a3b8);
        cursor: pointer;
        transition: all 0.2s;
      }
      .tool-icon-btn:hover {
        color: #ffffff;
        border-color: #0084ff;
        background: rgba(0, 132, 255, 0.1);
      }
      .zoom-control-row {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 12px;
        background: var(--bg-surface-elevated, #1a202c);
        padding: 8px 12px;
        border-radius: var(--radius-md, 8px);
        border: 1px solid var(--border-color, #273142);
      }
      .zoom-btn {
        width: 34px;
        height: 34px;
        border-radius: 6px;
        background: var(--bg-surface, #0f172a);
        border: 1px solid var(--border-color, #273142);
        color: var(--text-primary, #ffffff);
        font-weight: 800;
        font-size: 1.1rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.15s;
      }
      .zoom-btn:hover {
        border-color: #0084ff;
        color: #0084ff;
      }
      .zoom-slider {
        flex: 1;
        accent-color: #0084ff;
        cursor: pointer;
      }
      .zoom-val {
        font-size: 0.8rem;
        font-weight: 700;
        color: var(--text-primary, #ffffff);
        min-width: 44px;
        text-align: right;
        font-family: monospace;
      }
      .dimension-row {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 8px;
      }
      .lock-btn {
        background: var(--bg-surface-elevated, #1a202c);
        border: 1px solid var(--border-color, #273142);
        color: var(--text-secondary, #94a3b8);
        width: 44px;
        height: 44px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
        margin-top: 22px;
      }
      .lock-btn.locked {
        border-color: #0084ff;
        color: #0084ff;
        background: rgba(0, 132, 255, 0.12);
      }
      .action-row-split {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 12px;
      }
    
