/* ==========================================================================
   Protractor Tool - Interactive Angle Measurement
   ========================================================================== */

.pt-container {
    --pt-primary: #15aebf;
    --pt-primary-light: #4ecdc4;
    --pt-primary-dark: #0e9bb2;
    --pt-secondary: #ff6b35;
    --pt-accent: #ffd93d;
    --pt-success: #00b894;
    --pt-danger: #e17055;
    --pt-white: #ffffff;
    --pt-gray-100: #f1f3f4;
    --pt-gray-200: #e9ecef;
    --pt-gray-300: #dee2e6;
    --pt-text-primary: #2d3748;
    --pt-text-secondary: #4a5568;
    --pt-radius-md: 0.375rem;
    --pt-radius-lg: 0.75rem;
    --pt-radius-xl: 1rem;
    --pt-radius-full: 9999px;
    --pt-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --pt-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    min-height: 100vh;
    width: 100%;
    background: var(--pt-white);
    position: relative;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

/* Canvas Area */
.pt-canvas-area {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--pt-white);
    cursor: default;
}

.pt-canvas-area canvas {
    display: block;
    touch-action: none;
}

/* Watermark */
.pt-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    opacity: 0.06;
    pointer-events: none;
    z-index: 1;
}

/* Toolbar */
.pt-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.98);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--pt-gray-200);
    flex-shrink: 0;
    flex-wrap: wrap;
    z-index: 10;
}

.pt-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Toolbar Buttons */
.pt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.375rem 0.625rem;
    border: 1.5px solid var(--pt-gray-200);
    border-radius: var(--pt-radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--pt-white);
    color: var(--pt-text-secondary);
    min-height: 28px;
    white-space: nowrap;
}

.pt-btn:hover {
    background: var(--pt-gray-100);
    border-color: var(--pt-gray-300);
    color: var(--pt-text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.pt-btn:active {
    transform: translateY(0);
}

.pt-btn-toggle.active {
    background: linear-gradient(135deg, var(--pt-primary) 0%, var(--pt-primary-light) 100%);
    color: var(--pt-white);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(21, 174, 191, 0.3);
}

.pt-btn-toggle.active:hover {
    background: linear-gradient(135deg, var(--pt-primary-dark) 0%, var(--pt-primary) 100%);
    color: var(--pt-white);
    box-shadow: 0 4px 12px rgba(21, 174, 191, 0.4);
}

#ptSnapToggle.active {
    background: linear-gradient(135deg, var(--pt-accent) 0%, #ffe066 100%);
    color: var(--pt-text-primary);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(255, 217, 61, 0.4);
}

/* Angle Display */
.pt-angle-display {
    display: flex;
    align-items: baseline;
    gap: 0.125rem;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, var(--pt-primary) 0%, var(--pt-primary-light) 100%);
    border-radius: var(--pt-radius-full);
    box-shadow: 0 2px 10px rgba(21, 174, 191, 0.3);
    min-width: 70px;
    justify-content: center;
}

.pt-angle-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--pt-white);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1;
}

.pt-angle-symbol {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .tool-page-wrapper:has(.pt-container) {
        display: block;
        min-height: 0 !important;
    }

    .tool-content-area:has(.pt-container) {
        min-height: 0 !important;
        display: block;
    }

    .pt-container {
        min-height: 0;
    }

    .pt-canvas-area {
        height: 80vw;
        flex: none;
    }

    .pt-toolbar {
        padding: 0.25rem 0.375rem;
        gap: 0.375rem;
    }

    .pt-toolbar-group {
        gap: 0.25rem;
    }

    .pt-btn span {
        display: none;
    }

    .pt-btn {
        padding: 0.2rem 0.375rem;
        min-height: 24px;
    }

    .pt-angle-display {
        min-width: 50px;
        padding: 0.15rem 0.4rem;
    }

    .pt-angle-value {
        font-size: 1rem;
    }

    .pt-watermark {
        width: 100px;
    }
}

@media (max-width: 480px) {
    .pt-container {
        min-height: 0;
    }

    .pt-canvas-area {
        height: 80vw;
    }

    .pt-toolbar {
        padding: 0.15rem 0.25rem;
        gap: 0.25rem;
    }

    .pt-toolbar-group {
        gap: 0.15rem;
    }

    .pt-btn {
        padding: 0.15rem 0.3rem;
        font-size: 0.625rem;
        min-height: 22px;
    }

    .pt-angle-display {
        min-width: 44px;
        padding: 0.1rem 0.3rem;
    }

    .pt-angle-value {
        font-size: 0.9rem;
    }

    .pt-angle-symbol {
        font-size: 0.75rem;
    }

    .pt-watermark {
        width: 70px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .pt-btn {
        transition: none;
    }

    .pt-btn:hover {
        transform: none;
    }
}

/* Fullscreen adjustments */
.tool-page-wrapper:fullscreen .pt-container,
.tool-page-wrapper:-webkit-full-screen .pt-container {
    min-height: 100%;
    height: 100%;
}
