/* Reset default browser styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    background-color: #f4f4f9;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 2rem;
    font-weight: bold;
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-weight: bold;
    color: #555;
}

.control-group input,
.control-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.control-group input:focus,
.control-group select:focus {
    border-color: #007bff;
    outline: none;
}

.canvas-container {
    border: 2px solid #333;
    border-radius: 8px;
    margin: 20px 0;
    overflow: hidden;
    position: relative;
}

#signatureCanvas {
    width: 100%;
    height: 300px;
    cursor: crosshair;
    background-color: #fafafa;
}

.buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 1rem;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#clearBtn {
    background-color: #ff4444;
    color: white;
}

#saveBtn {
    background-color: #4CAF50;
    color: white;
}

#downloadBtn {
    background-color: #2196F3;
    color: white;
}

#undoBtn {
    background-color: #ff9800;
    color: white;
}

.saved-signatures {
    margin-top: 30px;
}

#signatureGallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.signature-item {
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.signature-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.signature-item img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.signature-item button {
    margin-top: 5px;
    padding: 5px 10px;
    font-size: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.signature-item button:hover {
    background-color: #0056b3;
}

/* Media Queries for Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.5rem;
    }

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

    .buttons {
        flex-direction: column;
        align-items: center;
    }

    button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 1.2rem;
    }

    .control-group label {
        font-size: 0.9rem;
    }

    .control-group input,
    .control-group select {
        padding: 8px;
    }

    .buttons button {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .signature-item button {
        font-size: 10px;
    }
}
